This project is archived and is in readonly mode.

#1834 ✓invalid
Frédéric de Villamil

Adding rspec-rails in config.gem forces the use of test database

Reported by Frédéric de Villamil | February 1st, 2009 @ 08:26 AM | in 2.x

  • Rails version : 2.2.2
  • Environment : production mode only, apache 2.2, mod_rails / mongrel (./script/server)
  • Applications : any (Typo, Redmine, personnal Rails app)

Adding a call to rspec-rails in your gems dependencies in environment.rb forces the use of test database, regardless the RAILS_ENV I can set, exporting env vars or forcing it in environment.rb

config.gem 'rspec-rails', :lib => 'spec/rails', :version => '>= 1.1.11'

Commenting the line just brings things back to normal

Comments and changes to this ticket

  • Matt Jones

    Matt Jones February 18th, 2009 @ 01:32 AM

    The problem is that rspec-rails overwrites the environment. Note the warning in rspec-rails's init.rb not to add any includes.

    You'll probably want to add :lib => false to your config.gem line to keep rspec from being loaded all the time.

    I don't think that the rspec generator is going be usable unless you've got the gem installed locally (see #1757).

  • CancelProfileIsBroken

    CancelProfileIsBroken April 22nd, 2009 @ 10:17 PM

    • State changed from “new” to “invalid”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>