Merge pull request #662 from joelvh/feature/app_env

Add APP_ENV
This commit is contained in:
Ernesto Tagwerker 2020-10-09 11:41:09 -04:00 committed by GitHub
commit 661fe7ef30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -323,7 +323,7 @@ After copying and pasting code to do this several times I decided to package it
DatabaseCleaner comes with safeguards against:
* Running in production (checking for `ENV`, `RACK_ENV`, and `RAILS_ENV`)
* Running in production (checking for `ENV`, `APP_ENV`, `RACK_ENV`, and `RAILS_ENV`)
* Running against a remote database (checking for a `DATABASE_URL` that does not include `localhost`, `.local` or `127.0.0.1`)
Both safeguards can be disabled separately as follows.

View File

@ -72,7 +72,7 @@ module DatabaseCleaner
end
class Production
KEYS = %w(ENV RACK_ENV RAILS_ENV)
KEYS = %w(ENV APP_ENV RACK_ENV RAILS_ENV)
def run
raise Error::ProductionEnv.new(key) if !skip? && given?

View File

@ -126,7 +126,7 @@ module DatabaseCleaner
end
describe 'ENV is set to production' do
%w(ENV RACK_ENV RAILS_ENV).each do |key|
%w(ENV APP_ENV RACK_ENV RAILS_ENV).each do |key|
describe "on #{key}" do
before { stub_const('ENV', key => "production") }