Skip to content

Commit

Permalink
Merge pull request #662 from joelvh/feature/app_env
Browse files Browse the repository at this point in the history
Add APP_ENV
  • Loading branch information
etagwerker authored Oct 9, 2020
2 parents d4ace20 + 9bc66d6 commit 661fe7e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/database_cleaner/safeguard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def skip?
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?
Expand Down
2 changes: 1 addition & 1 deletion spec/database_cleaner/safeguard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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") }

Expand Down

0 comments on commit 661fe7e

Please sign in to comment.