Please review pull request #519: Bug/2.7.x/12564 insufficient stubbing of childstatus opened by (daniel-pittman)

Description:

On my machine, $CHILDSTATUS is always "success", so I didn't notice the
failure to stub out the first couple of tests correctly. Now, with them
stubbed, it is no longer possible that a previous test can leave global state
dangling that will break their assumptions.

Signed-off-by: Daniel Pittman [email protected]

  • Opened: Tue Feb 21 00:14:27 UTC 2012
  • Based on: puppetlabs:2.7.x (c5cf798ca1d023352efb099fc1817a6948bfe8ce)
  • Requested merge: daniel-pittman:bug/2.7.x/12564-insufficient-stubbing-of-childstatus (4f493a32fb28bae85835951bf8ea0b6e954be5d9)

Diff follows:

diff --git a/spec/unit/util_spec.rb b/spec/unit/util_spec.rb
index a41125a..5f13ca3 100755
--- a/spec/unit/util_spec.rb
+++ b/spec/unit/util_spec.rb
@@ -457,11 +457,13 @@ def process_status(exitstatus)
 
     it "should execute a string as a string" do
       instance.expects(:open).with('| echo hello 2>&1').returns('hello')
+      $CHILD_STATUS.expects(:==).with(0).returns(true)
       instance.execpipe('echo hello').should == 'hello'
     end
 
     it "should execute an array by pasting together with spaces" do
       instance.expects(:open).with('| echo hello 2>&1').returns('hello')
+      $CHILD_STATUS.expects(:==).with(0).returns(true)
       instance.execpipe(['echo', 'hello']).should == 'hello'
     end
 

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to