commit
661fe7ef30
|
@ -323,7 +323,7 @@ After copying and pasting code to do this several times I decided to package it
|
||||||
|
|
||||||
DatabaseCleaner comes with safeguards against:
|
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`)
|
* 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.
|
Both safeguards can be disabled separately as follows.
|
||||||
|
|
|
@ -72,7 +72,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
class Production
|
class Production
|
||||||
KEYS = %w(ENV RACK_ENV RAILS_ENV)
|
KEYS = %w(ENV APP_ENV RACK_ENV RAILS_ENV)
|
||||||
|
|
||||||
def run
|
def run
|
||||||
raise Error::ProductionEnv.new(key) if !skip? && given?
|
raise Error::ProductionEnv.new(key) if !skip? && given?
|
||||||
|
|
|
@ -126,7 +126,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'ENV is set to production' do
|
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
|
describe "on #{key}" do
|
||||||
before { stub_const('ENV', key => "production") }
|
before { stub_const('ENV', key => "production") }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue