Displaying 5 results from an estimated 5 matches for "parametermatch".
Did you mean:
parametermatcher
2007 Nov 15
0
ParameterMatcher backwards compatibility broken
...rameter matching. More about this later, but in the meantime I
wanted to warn anyone bold enough to be working with "edge" Mocha,
that any custom parameter matchers they have written will be broken by
this change.
However it is easy enough to fix them. You need to derive the matcher
from ParameterMatcher::Base and you need to change the "==" method to
"matches?". This method is now supplied with an array of the remaining
parameters to match and you are expected to "consume" any parameters
that you match.
It''s probably easiest to see in an example [1] which...
2007 Oct 25
4
Insure a method is called with no arguments.
We''ve been working with the ParameterMatchers (so cool!) but I don''t
see a way to insure a method is called with no arguments.
I imagined something like:
user = mock(''User'')
user.expects(:friends).with(nothing)
Anyone run into this?
2007 Sep 11
3
Expectations on portions of arguments called.
I''d like to create expectations on just portions of the arguments a
function takes.
For example, I want to verify that the a certain ActiveRecord
association extension adds an order clause to the find options hash.
Currently I simply check the entire argument structure, something like this
def test_referring_journals_should_order_by_citation_count
article =
2007 Jun 21
3
only checking certain parameters for a method
I''m writing a test where I only care about one of the parameters being sent
to the method, does anyone think having a way to say that any value for a
parameter which I don''t care about is valid? I''m thinking something like:
def test_charge_is_for_10_bucks
gateway = test_gateway
member = Member.new
member.credit_card_number = "1"
2007 Sep 24
7
Parameter Matchers with optional params
Hi,
Are there any docs for combining parameter matchers, or some way to
define optional parameters? I''m trying to match something like:
.find( 42 ) || .find( 42, {:conditions=>nil,:includes=>nil} )
Or for that matter, 42 followed by nothing or anything... Halp? I''ve
tried different nested combos with any_of/all_of/anything, but
getting lost trying.
--Andrew