Module: RSpec::Rails::Mocha::ActiveRecordStubExtensions
- Defined in:
- lib/rspec/rails/mocha.rb
Instance Method Summary collapse
Instance Method Details
#as_new_record ⇒ Object
140 141 142 143 |
# File 'lib/rspec/rails/mocha.rb', line 140 def as_new_record self.__send__("#{self.class.primary_key}=", nil) super end |
#connection ⇒ Object
149 150 151 |
# File 'lib/rspec/rails/mocha.rb', line 149 def connection raise IllegalDataAccessException.new("stubbed models are not allowed to access the database") end |
#new_record? ⇒ Boolean
145 146 147 |
# File 'lib/rspec/rails/mocha.rb', line 145 def new_record? !persisted? end |