[mocha-developer] Nested matchers

Ned Wolpert ned.wolpert at gmail.com
Mon Jan 28 15:02:28 EST 2008


I'm also seeing a problem.  I haven't researched it enough, but here's
what's going on in a nutshell...

I have this line:

  outfile.stubs(:each_line).times(2).returns('1234512123\n','abcdefgxyz\n')

and then the object 'outfile' is passed in to another method that
called 'each_line' in a loop with result from the called being
'yield'ed... In a nutshell, like this

    fwr.process_file(outfile) do |array|
      validate_data(array)
    end

I'm not sure exactly where the error is, but this code hasn't changed
in a long time, but with the latest mocha, broke. I'm still
researching what is actually broken, but I kinda hope that this bit of
debug is helpful...

On Jan 28, 2008 12:36 PM, Duncan Beevers <duncanbeevers at gmail.com> wrote:
> We're encountering a failure with Mocha 0.5.6.
>
> We had this expectation:
>
> game_version.expects(:attributes=).with(:game_file =>
> kind_of(GameFile), :game_id => @game.id)
>
> This expectation was passing with 0.5.5, but fails with 0.5.6.
>
> I added this test to parameter_matcher_acceptance_test.rb, which
> passes in 0.5.5 and fails in 0.5.6
>
>   def test_should_match_nested_parameters
>     test_result = run_test do
>       mock = mock()
>       mock.expects(:method).with(:literal_key => kind_of(Integer))
>       mock.method(:literal_key => 1)
>     end
>     assert_passed(test_result)
>   end
>
> Any insight?
> _______________________________________________
> mocha-developer mailing list
> mocha-developer at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mocha-developer
>



-- 
Virtually, Ned Wolpert
http://www.codeheadsystems.com/blog/

"Settle thy studies, Faustus, and begin..."   --Marlowe


More information about the mocha-developer mailing list