search for: parameter_block

Displaying 5 results from an estimated 5 matches for "parameter_block".

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
2006 Sep 22
2
foo.expects(:blah).returns(10).then(11) syntax
...tion.invoke Index: lib/mocha/expectation.rb =================================================================== --- lib/mocha/expectation.rb (revision 854) +++ lib/mocha/expectation.rb (working copy) @@ -21,7 +21,7 @@ @method_name = method_name @count = 1 @parameters, @parameter_block = AlwaysEqual.new, nil - @invoked, @return_value = 0, nil + @invoked = 0 @backtrace = backtrace || caller end @@ -69,19 +69,29 @@ end def returns(value) - @return_value = value + return_value << value self end + + def then(value)...
2007 Jan 17
8
Mocha Mock''s hanging on after test run?
...pect assert !ActionController::Routing::Routes.named_routes end The print when test_zzz is run gives this: #<ActionController::Routing::RouteSet::NamedRouteCollection:0x14e0da8 @mocha=#<Mocha::Mock:0x2333504 @__mock_name=nil, @expectations=[#<Mocha::Expectation:0x2333158 @count=0, @parameter_block=nil, @backtrace=["test/controller/integration_test.rb:146:in `test_reset_bang_doesn_reinstall_named_routes''", "/usr/local/lib/ruby/1.8/test/unit/testcase.rb:72:in `__send__''", "/usr/local/lib/ruby/1.8/test/unit/testcase.rb:72:in `run''", &quot...
2007 Mar 12
10
using mocha with rspec
Hi folks. I''ve just started using rspec and I have to say it''s very nice. The thing is, I prefer mocha''s mocking dialect. So I thought a simple require ''mocha'' would set me up. Unfortunately, rspec does all its goodness using do/end blocks in anonymous classes, so it wasn''t quite that obvious. Anyway, here is the incantation I ended up
2007 Apr 12
15
Preview of Latest Mocha Changes
...on''t don''t know how many people out there are using trunk, but it would be great to get some feedback on these changes before I make a new release. In particular I''d like to know whether? - I''ve broken anybody''s tests. - Anybody has a legitimate use for parameter_block in Expectation#with that they don''t think will be handled by a suitable parameter matcher i.e. using the current behaviour where the block is passed the parameters and the result of the block determines whether the expectation matches. I''m planning on deprecating this soon. - Anyb...