module RSpec::ActiveModel::Mocks::Mocks::ActiveModelInstanceMethods
Public Instance Methods
as_new_record()
click to toggle source
Stubs `persisted?` to return false and `id` to return nil @return self
# File lib/rspec/active_model/mocks/mocks.rb, line 12 def as_new_record RSpec::Mocks.allow_message(self, :persisted?).and_return(false) RSpec::Mocks.allow_message(self, :id).and_return(nil) self end
persisted?()
click to toggle source
Returns true by default. Override with a stub.
# File lib/rspec/active_model/mocks/mocks.rb, line 19 def persisted? true end
respond_to?(message, include_private=false)
click to toggle source
Returns false for names matching /_before_type_cast$/
, otherwise delegates to super.
Calls superclass method
# File lib/rspec/active_model/mocks/mocks.rb, line 25 def respond_to?(message, include_private=false) message.to_s =~ /_before_type_cast$/ ? false : super end