I am using Rails3 (beta4) and RSpec2 (beta 15) under RVM and am running
an interesting issue.
My request tests using webrat seem to think that they are running in the
development Rails environment (I know this because I get all kinds of
entries in the development log) and that is messing with Factory Girl
If I run “env” from the OSX command line, I have an entry for RAILS_ENV
After some poking around, I found the line:
ENV[“RAILS_ENV”] ||= ‘test’
in the spec_helper.rb file. I figured that this might be why webrat runs
the development environment since the above line won’t do anything if
RAILS_ENV is already set (which it is).
If I remove the “||” from the above line, everything seems to work fine
webrat now stops putting stuff into the development log and puts stuff
the test log and the strangeness with factory_girl_rails goes away.
I would like to confirm that removing the “||” from the spec_helper.rb
isn’t going to mess with anything later down the road ro get an
as to why one wouldn’t want to always force RAILS_ENV to be equal to
when running specs.