[rspec-users] Expected "with" matches received "with" in error message

Tom Hoen lists at ruby-forum.com
Mon Nov 3 11:01:40 EST 2008


> 
> To get this to work you'll have to either use real records (with IDs)
> or stub whatever it is that is supplying the Relative and then expect
> with(the_relative_you_supply_as_a_stub_value).
> 
> Make sense?

In part, but not 100%. Here is the code from the controller. Since all 
objects are expected to be new, I am not clear whether using real 
objects would create a false test. I am quite new to rspec, and 
admittedly don't fully grasp when to mock and when to not.

    @student = Student.new
    2.times { @student.relatives << Relative.new(:parent => Parent.new) 
}
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list