-
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
DatabaseCleaner cleans my development database instead of test #523
Comments
Set your environment from the shell, not from Ruby.
If you set it from inside a Ruby file, then |
I'm not sure if you have read what I have written. code inside some test: database_cleaner is present only in the test environment:
|
@RTJ Could you post a bit more information about your environment? Please share keys/values without exposing any sensitive information. We've seen unexpected behavior like this when |
There was some bug, this problem was present in different devices. For now i fixed it adding ENV['RAILS_ENV'] = 'test' to spec_helper.rb ( i had it only in rails_helper.rb but it seems that it is not enough for database_cleaner ) |
@RTJ Thanks for sharing! I'm glad it's solved. |
@RTJ @etagwerker Having the exact same issue! wondering how does your
So, why the need to add it to My hunch is that this can really be a bug. Thoughts? |
Having the same issue with Rails 6 - using v1.8.5. |
↑ My this comment means the same thing, 77dece1 made |
Perhaps when you run your RSpec, you are not specifying the |
Hi.
DatabaseCleaner cleans my development database instead of test
I have tried all possible configurations.
And I still have this problem.
database_cleaner 1.6.2
Rails: 5.1.5
Ruby 2.5
Gemfile:
in rails_helper i have forced env to test:
ENV['RAILS_ENV'] = "test"
DatabaseCLeaner conf file ( i have tried all posible combinations for configuration:
From tests when i print ENV i get TEST env but each time after test my development database is cleaned and test database is not used:
p ENV["RAILS_ENV"] #=> "test"
database config file have default configuration for test:
Any idea where to look to fix this bug ?
**after executing the rspec command all the data in my development database is deleted **
Thx
The text was updated successfully, but these errors were encountered: