puppetlabs/puppet — pull request #2849 by joshcooper (2014-07-08 05:35:16+00:00)
Title: (maint) Don't try to set expectations on $CHILD_STATUS

Previously, executing bundle exec rspec spec/unit/util/execution_spec.rb
would fail on windows with an rspec error:

unexpected invocation: nil.==(/error message/)

The issue first appears in commit f41800a. I believe because before
f41800a, facter would evaluate the certname fact, executing `hostname.exe`
prior to executing the rspec example. As a result $CHILD_STATUS was never
nil when the test executed.

But starting in f41800a, $CHILD_STATUS may be nil as can be seen by the
rspec output:

expected exactly once, invoked once: nil.==(0)

Since the object we are trying to set an expectation on is global and
sometimes doesn't exist, this commit creates a private method for stubbing
and setting expectations on the $CHILD_STATUS.exitstatus