We’re using migrations for generating our test schemas (for a whole load
of reasons) and need to specifically run code when we are running our
rspec tests as opposed to running the actual migrations on the
production or development boxes.
Is there a way to detect the current environment that rspec is
connecting too?
I’ve tried looking in ENV[‘RAILS_ENV’] but it doesn’t appear to be set.
I’ve also tried looking in ActiveRecord::Base.connection to see if the
connection would give me a clue.
I want to do something like:
if RAILS_ENVIRONMENT == ‘TEST’
RUN THIS SQL
end