On Jul 6, 2010, at 10:43 AM, Mike Gehard wrote: > Good morning, > > 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 > factory_girl_rails gem). > > If I run "env" from the OSX command line, I have an entry for RAILS_ENV = > development.
Why do you have that? I'd get rid of this if you don't need it for something explicit. > 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. This shouldn't mess with anything else downstream. The ||= is there so you can set the environment to other special-case testing environments like this: RAILS_ENV=ci rake spec HTH, David > Thanks, > Mike > > -- > Mike Gehard > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users