evansagge/mongoid-rspec — Issue #54: Mongoid-rspec with Factory girl
Author: swapnilchincholkar
Created: 2012-01-11 12:03:58+00:00
State: open

Hey, I am using mongoid-rspec.
As per the README, my validation and association specs such as
describe User do
it { should validate_presence_of(:fax) }
it { should validate_presence_of(:phone) }
it { should have_many(:accounts).with_dependent(:delete) }
it { should embed_one :address }
end
runs very well.

I have created factory for user at spec/factories/user.rb as,
Factory.define :user do |u|
u.email "test@test_user.com"
u.password "123456"
end

When I add a line to specs such as
it { should save }
it gives me error as ,
Failures:

1) User
Failure/Error: it { should save }
NameError:
undefined local variable or method `save' for #
# ./spec/models/user_spec.rb:5:in `block (2 levels) in '

Can anyone tell me why it is not working?