diff options
author | Aaron Stone <aaron@serendipity.cx> | 2014-10-29 07:08:37 -0700 |
---|---|---|
committer | Aaron Stone <aaron@serendipity.cx> | 2014-10-29 07:08:37 -0700 |
commit | 35f773056485f06fc42e9e4dced930de7a3e1fa2 (patch) | |
tree | 2623269e03771c1e512c3e3d11136480b52f3bd2 /spec | |
parent | f6f870b959d1c897cbe23778e54087550e110d14 (diff) | |
parent | 2b927e514a3d8aef5d35094e84dee3d6b47d6bf2 (diff) | |
download | puppet-vcsrepo-35f773056485f06fc42e9e4dced930de7a3e1fa2.tar.gz puppet-vcsrepo-35f773056485f06fc42e9e4dced930de7a3e1fa2.tar.bz2 |
Merge pull request #213 from jfautley/cvs-runas
Add `user` feature support to CVS provider
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/puppet/provider/vcsrepo/cvs_spec.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb index f5eebd9..2e18149 100644 --- a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb @@ -23,14 +23,23 @@ describe Puppet::Type.type(:vcsrepo).provider(:cvs_provider) do resource[:source] = ':ext:source@example.com:/foo/bar' resource[:revision] = 'an-unimportant-value' expects_chdir('/tmp') - provider.expects(:cvs).with('-d', resource.value(:source), 'checkout', '-r', 'an-unimportant-value', '-d', 'test', 'bar') + Puppet::Util::Execution.expects(:execute).with([:cvs, '-d', resource.value(:source), 'checkout', '-r', 'an-unimportant-value', '-d', 'test', 'bar'], :custom_environment => {}) + provider.create + end + + it "should execute 'cvs checkout' as user 'muppet'" do + resource[:source] = ':ext:source@example.com:/foo/bar' + resource[:revision] = 'an-unimportant-value' + resource[:user] = 'muppet' + expects_chdir('/tmp') + Puppet::Util::Execution.expects(:execute).with([:cvs, '-d', resource.value(:source), 'checkout', '-r', 'an-unimportant-value', '-d', 'test', 'bar'], :uid => 'muppet', :custom_environment => {}) provider.create end it "should just execute 'cvs checkout' without a revision" do resource[:source] = ':ext:source@example.com:/foo/bar' resource.delete(:revision) - provider.expects(:cvs).with('-d', resource.value(:source), 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))) + Puppet::Util::Execution.expects(:execute).with([:cvs, '-d', resource.value(:source), 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))], :custom_environment => {}) provider.create end @@ -39,7 +48,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:cvs_provider) do resource[:source] = ':ext:source@example.com:/foo/bar' resource[:compression] = '3' resource.delete(:revision) - provider.expects(:cvs).with('-d', resource.value(:source), '-z', '3', 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))) + Puppet::Util::Execution.expects(:execute).with([:cvs, '-d', resource.value(:source), '-z', '3', 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))], :custom_environment => {}) provider.create end end @@ -48,7 +57,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:cvs_provider) do context "when a source is not given" do it "should execute 'cvs init'" do resource.delete(:source) - provider.expects(:cvs).with('-d', resource.value(:path), 'init') + Puppet::Util::Execution.expects(:execute).with([:cvs, '-d', resource.value(:path), 'init'], :custom_environment => {}) provider.create end end @@ -107,7 +116,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:cvs_provider) do it "should use 'cvs update -dr'" do expects_chdir - provider.expects(:cvs).with('update', '-dr', @tag, '.') + Puppet::Util::Execution.expects(:execute).with([:cvs, 'update', '-dr', @tag, '.'], :custom_environment => {}) provider.revision = @tag end end |