208: def add_model_methods(mock, model_class, id)
209: container = mock.flexmock_container
210: mock.should_receive(
211: :id => id,
212: :to_params => id.to_s,
213: :new_record? => false,
214: :class => model_class,
215: :errors => container.flexmock("errors", :count => 0))
216:
217:
218: lambda { }
219: mock.should_receive(:is_a?).with(any).and_return { |other|
220: other == model_class
221: }
222: mock.should_receive(:instance_of?).with(any).and_return { |other|
223: other == model_class
224: }
225: mock.should_receive(:kind_of?).with(any).and_return { |other|
226: model_class.ancestors.include?(other)
227: }
228: end