[mocha-developer] Mocking system/`

Kevin Clark kevin.clark at gmail.com
Mon Jun 11 18:19:02 EDT 2007

This drives me insane on a regular basis. How does one mock
system('blah') or `blah` ?

Adding expectations on Kernel doesn't do it. Adding expectations on
Object just makes me sad:

  # => #<Mock:0x12b584e>.system('ls') - expected calls: 0, actual calls: 1

And this really shouldn't work (and doesn't):

  # => #<Mock:0x12f287a>.system('ls') - expected calls: 1, actual calls: 0

Anyone have a trick they like?

Kevin Clark

More information about the mocha-developer mailing list