Add spec test for invokation as a different user
authorJon Fautley <jon.fautley@fil.com>
Wed, 29 Oct 2014 11:00:33 +0000 (11:00 +0000)
committerJon Fautley <jon.fautley@fil.com>
Wed, 29 Oct 2014 11:00:33 +0000 (11:00 +0000)
spec/unit/puppet/provider/vcsrepo/cvs_spec.rb

index b146d70..2e18149 100644 (file)
@@ -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)