[mocha-developer] Changing the value of $?

Kevin Clark kevin.clark at gmail.com
Tue Jun 19 19:30:12 EDT 2007


This is working for me, right now:

   $?.stubs(:exitstatus).returns(0)

also (though I know the proc version is deprecated) :

    Job.any_instance.expects(:`).with() {|call| call =~ /ssh/ }.returns(lambda {
      $?.expects(:exitstatus).returns(-1)
      '11807'
    })


On 6/19/07, James Mead <jamesmead44 at gmail.com> wrote:
> The only thing I can suggest is to wrap the $? execution environment
> variable in a method e.g. exit_status(). Then you could then stub the
> exit_status() method to return your desired result.
> --
> James.
> http://blog.floehopper.org
> _______________________________________________
> mocha-developer mailing list
> mocha-developer at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mocha-developer
>


-- 
Kevin Clark
http://glu.ttono.us


More information about the mocha-developer mailing list