Displaying 1 result from an estimated 1 matches for "real_exit".
Did you mean:
real_exc
2007 Oct 07
2
Specing exit codes
...something else and replacing it... all without joy.
The spec runs and hits the "exit 1" in init.rb and does what it is
mean to do... exit. But that also exits RSpec and so the test is
never run!
The only thing I found DID work is if I alias Kernel.exit inside the
init.rb file to "real_exit" and then redefine Kernel exit like so:
class Object
module Kernel
alias real_exit exit
def exit(arg)
return true if arg == 1
end
end
end
and then test exit by mocking it and making sure it returns true...
but a spec that has to modify the test code isn''t going...