Reputation: 389
When I write rspec and run line by line with line number. It works fine and pass.
When I run the whole rspec, it fail
context "scope" do
before do
@current_user = User.current = User.first
end
it "should have user" do
@current_user.should_not be_nil
end
end
I have spending hours to find out why it is failing.
Upvotes: 0
Views: 84
Reputation: 115541
I'm pretty sure your tests are interferring.
Use databasecleaner to reset everything automatically between each test.
See ref here:
https://github.com/bmabey/database_cleaner
Upvotes: 2