In Rails 2.x, using Mocha, I was trying a pretty simple excercise, mocking an activerecord model, and an association.
I wrote something like this:
test "setting the home_phone works" do a_phone = mock() a_card = Card.new(:name => "Joe Winston") a_card.home_phone = a_phone assert_equal a_phone, a_card.home_phone end
Card is specified to has_one :home_phone.
I got the error below the dashed line, which to me says that ActiveRecord is not recognizing the mocked variable a_phone as a proper object to add to the association. I did a bunch of digging but could not figure out how to get the mock to work with Active Record.
Does anyone have a tip, it would be greatly appreciated! (p.s. I couldn't find a mocha specific list, which is why I posted here.)
Thanks!
Pito