Basic database methods like "save", which worked previously, are not working anymore, and I can't find existing questions addressing why.
Running bundle exec rails spec/ throws an undefined save for nil:Nilclass error for many locations.
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:242:in 'module_eval' c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:242:in 'subclass' c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:228:in 'describe and so on...
Could it due to gem version mismatches?
My test and development databases using postgresql are up to date and fully migrated.
I made sure to have
config.include Capybara::DSL
in my spec_helper.rb file.
user_spec.rb
.
.
.
describe "with mixed case" do
let(:mixed_case_email) { "[email protected]" }
before { @user.email = mixed_case_email }
describe "should be saved as all lower-case" do
@user.save
expect(@user.email).to eq mixed_case_email.downcase
end
describe "and that's already taken" do
before { user_with_same_email = @user.dup
user_with_same_email.email
user_with_same_email.save }
describe "should be invalid" do
it { should_not be_valid }
end
end
.
.
.
user_with_same_email.email; userr_with_same_email.save
inside the context of a test. – sevenseacat