Displaying 1 result from an estimated 1 matches for "param_that_is_a_str".
2007 Jun 21
3
With Parameter Block
...so 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 prefer to be able
to write my tests explicitly instead of c...