Date: 2007-04-27 16:39 Sender: Brian Takita
Allow mock expectations to be defined within a block. This
syntax is similar to ActiveRecord and Markaby.
In these examples, the block is instance evaled with the binding
of the mock.
mock('The new mock') do
foo(1,2) {:bar}
baz(3,4).returning(:foobar)
end
User.mocks do
find('3').once {user}
destroy(7)
end
An alternate syntax does not instance eval the block.
mock('The new mock') do |m|
m.foo(1,2) {:bar}
m.baz(3,4).returning(:foobar)
end
User.mocks do |m|
m.find('3').once {user}
m.destroy(7)
end
This feature request is coupled with the merge with block into
the method name expectation feature.
http://rubyforge.org/tracker/ind...