guard/guard-rspec — pull request #75 by ashmoran (2011-11-27 14:42:51+00:00)
Title: Enable multiple guard instances

I believe this resolves issue #74 in Guard::RSpec

I came across some very weird behaviour in the process of converting the module code to instantiable classes though. The specs rely on something I've never seen in Ruby before, that the value of `$?` after a `system` call is preserved going into a method on a Module (and presumably a Class) object, but not an instance of a class. Because of this, I had to trick `Runner#rspec_command` into running `system "exit …"`.

The specs that were stubbing out `Runner#system` (inherited from Object) were also relying on the call being stubbed out in `Runner#failure_exit_code_supported?`, so I stubbed this private method out directly.

These spec changes are not ideal, but they did allow me to solve my immediate problem without going into a much bigger refactoring. A nice next step would be to extract the code that deals with `system` and the command generation into a separate object (and being able to mock this would probably help speed up the test runs considerably).