Module: RSpec::Rails::Mocks::ActiveModelStubExtensions
- Defined in:
- lib/rspec/rails/mocks.rb
Instance Method Summary collapse
-
#as_new_record ⇒ Object
Stubs
persisted
to return false andid
to return nil. -
#persisted? ⇒ Boolean
Returns
true
by default.
Instance Method Details
#as_new_record ⇒ Object
Stubs persisted
to return false and id
to return nil
152 153 154 155 156 |
# File 'lib/rspec/rails/mocks.rb', line 152 def as_new_record RSpec::Mocks.(self, :persisted?).and_return(false) RSpec::Mocks.(self, :id).and_return(nil) self end |
#persisted? ⇒ Boolean
Returns true
by default. Override with a stub.
159 160 161 |
# File 'lib/rspec/rails/mocks.rb', line 159 def persisted? true end |