[rspec-users] Strange behavior with using webrat in requests tests
mgehard at pivotallabs.com
Tue Jul 6 11:43:45 EDT 2010
I am using Rails3 (beta4) and RSpec2 (beta 15) under RVM and am running into
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 (the
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 in
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 and
webrat now stops putting stuff into the development log and puts stuff into
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 file
isn't going to mess with anything later down the road ro get an explanation
as to why one wouldn't want to always force RAILS_ENV to be equal to "test"
when running specs.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users