add_model_methods (FlexMock::MockContainerHelper)

         # File lib/flexmock/mock_container.rb, line 209
    209:     def add_model_methods(mock, model_class, id)
    210:       container = mock.flexmock_container
    211:
    212:       mock_errors = container.flexmock("errors")
    213:       mock_errors.should_receive(:count).and_return(0).by_default
    214:       mock_errors.should_receive(:full_messages).and_return([]).by_default
    215:
    216:       mock.should_receive(:id).and_return(id).by_default
    217:       mock.should_receive(:to_params).and_return(id.to_s).by_default
    218:       mock.should_receive(:new_record?).and_return(false).by_default
    219:       mock.should_receive(:class).and_return(model_class).by_default
    220:       mock.should_receive(:errors).and_return(mock_errors).by_default
    221:
    222:       # HACK: Ruby 1.9 needs the following lambda so that model_class
    223:       # is correctly bound below.
    224:       lambda { }
    225:       mock.should_receive(:is_a?).with(any).and_return { |other|
    226:         other == model_class
    227:       }.by_default
    228:       mock.should_receive(:instance_of?).with(any).and_return { |other|
    229:         other == model_class
    230:       }.by_default
    231:       mock.should_receive(:kind_of?).with(any).and_return { |other|
    232:         model_class.ancestors.include?(other)
    233:       }.by_default
    234:     end