summaryrefslogtreecommitdiff
path: root/spec/acceptance/modules_1800_spec.rb
blob: 12415e8032d30d80b61854075c5f7b3b96b7c408 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'spec_helper_acceptance'

tmpdir = default.tmpdir('vcsrepo')

describe 'clones a remote repo' do
  before(:all) do
    my_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
    shell("mkdir -p #{tmpdir}") # win test
  end

  after(:all) do
    shell("rm -rf #{tmpdir}/vcsrepo")
  end

  context 'ensure latest with no revision' do
    it 'clones from default remote' do
      pp = <<-EOS
      vcsrepo { "#{tmpdir}/vcsrepo":
          ensure   => present,
          provider => git,
          source   => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git",
      }
      EOS

      apply_manifest(pp, :catch_failures => true)
      shell("cd #{tmpdir}/vcsrepo; /usr/bin/git reset --hard HEAD~2")
    end

    it 'updates' do
      pp = <<-EOS
      vcsrepo { "#{tmpdir}/vcsrepo":
          ensure   => latest,
          provider => git,
          source   => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git",
      }
      EOS

      apply_manifest(pp, :catch_failures => true)
    end
  end
end