We had an issue the last couple of weeks on a new Rails project we started here at my gig. All Rails exceptions were quietly logged without showing any stack trace to browser. This was very annoying. Secondly, the RAILS_ENV was reported as “test”. mmmm, very suspicious. After some investigation I found the culprit on rails.rb line #1 of rails-rspec gem installed in our vendor dir:
Take a look at this to get a little context:
http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies
How can rspec affect your actual Rails environment, script/server, script/console, script/about? I’ll show you. enter our environment.rb:
config.gem ‘rspec-rails’,
:version => ‘>= 1.1.11′, :lib => ’spec/rails’
config.gem ‘rspec’,
:version => ‘>= 1.1.11′, :lib => ’spec’
Aha! So effectively, by including our gems here too (and gaining the added benefits noted above at ryandaigle.com )rather than simply in our spec_helper, we replaced our RAILS_ENV and invoked the Rails equivalent of an exception black hole.
