Displaying 1 result from an estimated 1 matches for "not_bar".
Did you mean:
foo_bar
2007 Nov 13
5
how to ensure signature compliance while mocking in ruby
...d a while ago, but I''d
like to reintroduce it asap.
You can already restrict expecations on *mocks* by using the responds_like
modifier [2], something like this...
class Foo
def bar
end
end
def test_me
foo = mock(''foo'')
foo.responds_like(Foo.new)
foo.expects(:not_bar)
foo.not_bar
end
# => NoMethodError: undefined method `not_bar'' for #<Mock:foo> which
responds like #<Foo:0x432e5c>
--
James.
http://blog.floehopper.org
http://tumble.floehopper.org
[1] http://mocha.rubyforge.org
[2] http://mocha.rubyforge.org/classes/Mocha/Mock.html#M...