-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoMethodError: undefined method 'state' for nil:NilClass #692
Comments
UP i'm getting randomly the same issue, any updates ? |
I saw @navidmad said it happened to him randomly so I solved it by restarting my PC. Quite fun,hh.
|
Same here.... Looking forward for fix... |
Same here. No updates? |
Well, this is definitely still a problem but I have a few things:
My current solution is the following: # rails_helper.rb
RSpec.configure do |config|
# ...
config.around do |example|
DatabaseCleaner.cleaning do
example.run
end
rescue NoMethodError => e
next if e.message.match? 'undefined method `state\' for nil:NilClass'
raise e
end
end This is definitely a bit ugly, but it works 🤷 |
Pay attention to the asynchronous behavior of your code. The cleaner may break precisely because of asynchronous interaction with the database |
@lxnewayfarer, I wish I had read your comment a few days ago. Doing a rails 7.1 upgrade had super super weird failures in the tests. Getting messages like Turns out |
Setup
Error
From time to time, if a run my specs locally it might throw the error below, the fun thing is it errors for like two or three runs and then it passes (using same seed at all times);
This error also occurs occasionally on GitHub Actions, I have to re-run my workflow some times as well to make it pass (different seeds)
Database Cleaner Config
Any idea what might be causing this error and how to fix it?
Thanks for the gem and your attention.
The text was updated successfully, but these errors were encountered: