Skip to content

Set RAILS_ENV to test in rails_helper #1947

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

Closed
wants to merge 1 commit into from

Conversation

rodrigobdz
Copy link

@rodrigobdz rodrigobdz commented Jan 22, 2018

This is a solution to tests running in development environment as stated in issues #70 and #586.
Before Rails 3.2.7, ENV['RAILS_ENV'] ||= 'test' ran tests without issues in test env as discussed in rails/rails#7175 (comment).

This is a solution to tests running in development environment as stated in issues rspec#70 and rspec#586.
Before Rails 3.2.7 ENV['RAILS_ENV'] ||= 'test' ran tests without issues in test env as discussed in rails/rails#7175 (comment).
@mikegee
Copy link

mikegee commented Jan 23, 2018

I always make this change in my rails_helper. The justification in #70 seems kinda weak:

I don't want to force it to 'test' because that ties everybody's hands.

This file is in my app, not in RSpec.

@JonRowe
Copy link
Member

JonRowe commented Jan 26, 2018

The justification behind this is that it's a template, and this is the friendliest, safest option. Its perfectly ok to modify in your own projects, but it's not our recommended thing to do, thus closing. Thanks for taking the time to contribute :)

@JonRowe JonRowe closed this Jan 26, 2018
@rodrigobdz rodrigobdz deleted the patch-1 branch January 26, 2018 08:49
@rodrigobdz
Copy link
Author

rodrigobdz commented Jan 26, 2018

It should at least be warned about its implications in the README. That caused my tests to run in development environment and the entire database was wiped out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants