# File lib/spec/rails/mocks.rb, line 11
      def mock_model(model_class, options_and_stubs = {})
        id = options_and_stubs[:id] || next_id
        options_and_stubs = options_and_stubs.reverse_merge({
          :id => id,
          :to_param => id.to_s,
          :new_record? => false,
          :errors => stub("errors", :count => 0)
        })
        m = mock("#{model_class.name}_#{id}", options_and_stubs)
        m.send(:__mock_proxy).instance_eval "def @target.as_new_record\nself.stub!(:id).and_return nil\nself.stub!(:to_param).and_return nil\nself.stub!(:new_record?).and_return true\nself\nend\ndef @target.is_a?(other)\n\#{model_class}.ancestors.include?(other)\nend\ndef @target.kind_of?(other)\n\#{model_class}.ancestors.include?(other)\nend\ndef @target.instance_of?(other)\nother == \#{model_class}\nend\ndef @target.class\n\#{model_class}\nend\n"
        yield m if block_given?
        m
      end