Hello all. I have a quick mock_model question. Is there a way to
use it when doing ActiveRecord testing outside of rails? What I want
to be able to do with my ActiveRecord is this:
class Child
belongs_to :parent
end
child.parent = mock_model(Parent)
Now in rails I can do this, because mock_model does enough to fool
ActiveRecord into think the relationship is valid, but to do this
outside of rails I have to stub! the parent method to return the mock
and only use the stubbed method in it. That’s not particularly safe,
and I bet there’s a simple solution to this problem.
Eric Smith