From 9cef7c46c98153affbb3cd02e4a26afb43664e6d Mon Sep 17 00:00:00 2001 From: Jon Fautley Date: Wed, 29 Oct 2014 10:59:58 +0000 Subject: Rework spec tests to support new execution method --- spec/unit/puppet/provider/vcsrepo/cvs_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/unit/puppet/provider') diff --git a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb index f5eebd9..b146d70 100644 --- a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb @@ -23,14 +23,14 @@ 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 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 +39,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 +48,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 +107,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 -- cgit v1.2.3 From 2b927e514a3d8aef5d35094e84dee3d6b47d6bf2 Mon Sep 17 00:00:00 2001 From: Jon Fautley Date: Wed, 29 Oct 2014 11:00:33 +0000 Subject: Add spec test for invokation as a different user --- spec/unit/puppet/provider/vcsrepo/cvs_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/unit/puppet/provider') diff --git a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb index b146d70..2e18149 100644 --- a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb @@ -27,6 +27,15 @@ describe Puppet::Type.type(:vcsrepo).provider(:cvs_provider) do 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) -- cgit v1.2.3