Skip to content

Prevent running in production mode by default. #1383

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

Merged
merged 2 commits into from
May 27, 2015

Conversation

cupakromer
Copy link
Member

Many setups start tests by truncating the database tables. Running the
specs in production would, horribly, would delete all of the data. This
checks to make sure Rails is not in production before loading
rspec-rails and the configuration. If production mode is detected the
run will abort immediately.

Resolve #1382

Many setups start tests by truncating the database tables. Running the
specs in production would, horribly, would delete all of the data. This
checks to make sure Rails is not in production before loading
rspec-rails and the configuration. If production mode is detected the
run will abort immediately.

Resolve #1382
@myronmarston
Copy link
Member

LGTM

@cupakromer cupakromer force-pushed the include-production-check branch from 6e7c8d4 to 5d27de7 Compare May 27, 2015 20:06
cupakromer added a commit that referenced this pull request May 27, 2015
Prevent running in production mode by default.
@cupakromer cupakromer merged commit a2a37ee into master May 27, 2015
@cupakromer cupakromer deleted the include-production-check branch May 27, 2015 20:06
@mauriciogracia
Copy link

thanks, running this on production made me loose my job.

@myronmarston
Copy link
Member

thanks, running this on production made me loose my job.

😢 Sorry to hear that! Wish we had thought to put this in place sooner. Good luck with the job search! Frankly, an employer that fires employees over mistakes is not fostering the kind of environment I'd want to work in. I hope you find a better place to work!

@cupakromer
Copy link
Member Author

thanks, running this on production made me loose my job

😭 I'm sorry. I hope this turns out to be a good thing in disguise for you. 💙

@JonRowe
Copy link
Member

JonRowe commented May 27, 2015

It's worth noting that the default environment is actually development, you'd have to have the environment variable set elsewhere to get into production mode, and have production credentials on your development machine (or worse be developing on a production machine) but this is still a sensible precaution.

Hope you find a new job soon!

nickcharlton added a commit to thoughtbot/suspenders that referenced this pull request May 29, 2019
Suspenders was checking for the presence of `DATABASE_URL` to see if it
was running in production. This isn't so reliable in practice as
`DATABASE_URL` can be used in other environments. The spirit of this was
originally to stop you truncating a production database, which checking
for the Rails environment acheives.

#872
rspec/rspec-rails#1383
nickcharlton added a commit to thoughtbot/suspenders that referenced this pull request Nov 1, 2019
Suspenders was checking for the presence of `DATABASE_URL` to see if it
was running in production. This isn't so reliable in practice as
`DATABASE_URL` can be used in other environments. The spirit of this was
originally to stop you truncating a production database, which checking
for the Rails environment acheives.

#872
rspec/rspec-rails#1383
Web-Go-To added a commit to Web-Go-To/rails_suspenders that referenced this pull request Mar 23, 2023
Suspenders was checking for the presence of `DATABASE_URL` to see if it
was running in production. This isn't so reliable in practice as
`DATABASE_URL` can be used in other environments. The spirit of this was
originally to stop you truncating a production database, which checking
for the Rails environment acheives.

thoughtbot/suspenders#872
rspec/rspec-rails#1383
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.

rspec-rails should be configured by default to not be run on RAILS_ENV=production
4 participants