11

Is there a Mocha equivalent of Rspec’s “mock().as_null_object”?

Vega
  • 27,856
  • 27
  • 95
  • 103
Evan
  • 271
  • 1
  • 6

1 Answers1

16

Yes. Use “stub_everything()”

Documented here: http://mocha.rubyforge.org/classes/Mocha/API.html#M000004.

Bryan Ash
  • 4,385
  • 3
  • 41
  • 57
Evan
  • 271
  • 1
  • 6
  • 4
    `stub_everything` always returns nil, `as_null_object` always returns the stub, so they aren't quite the same – Jim Deville Nov 01 '12 at 21:33