MODULES-1800 - fix case where ensure => latest and no revision specified
[puppet_vcsrepo.git] / spec / acceptance / modules_1800_spec.rb
1 require 'spec_helper_acceptance'
2
3 tmpdir = default.tmpdir('vcsrepo')
4
5 describe 'clones a remote repo' do
6   before(:all) do
7     my_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
8     shell("mkdir -p #{tmpdir}") # win test
9   end
10
11   after(:all) do
12     shell("rm -rf #{tmpdir}/vcsrepo")
13   end
14
15   context 'ensure latest with no revision' do
16     it 'clones from default remote' do
17       pp = <<-EOS
18       vcsrepo { "#{tmpdir}/vcsrepo":
19           ensure   => present,
20           provider => git,
21           source   => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git",
22       }
23       EOS
24
25       apply_manifest(pp, :catch_failures => true)
26       shell("cd #{tmpdir}/vcsrepo; /usr/bin/git reset --hard HEAD~2")
27     end
28
29     it 'updates' do
30       pp = <<-EOS
31       vcsrepo { "#{tmpdir}/vcsrepo":
32           ensure   => latest,
33           provider => git,
34           source   => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git",
35       }
36       EOS
37
38       apply_manifest(pp, :catch_failures => true)
39     end
40   end
41 end