Displaying 1 result from an estimated 1 matches for "some_mock".
Did you mean:
some_doc
2007 Jun 21
3
With Parameter Block
...he concept of clean, readable tests, however I also like to
test as efficiently as possible. For some tests, I''ll take the
approach of putting test assertions inside the parameter block, and
always returning true.
This is a contrived example:
def test_something
mock = mock("some_mock")
mock.expects(:foo).with do | param_that_is_a_string,
param_that_is_a_model |
assert_match(/something-for1/, param_that_is_a_string)
assert param_that_is_a_model.valid?
true
end.returns("blah")
end
Again, I''m not against code readability, but I do pr...