My rake tasks for running Cucumber and RSpec tests are always using my development
environment.
Here are the relevant config files:
RAILS_ROOT
Not only config files are relevant to setting up rails environment.
Check your lib/tasks/cucumber.rake
file and if it doesn't contain it already add one of the following lines to it depending on your rails version (I added it after 'begin' line):
ENV["RAILS_ENV"] ||= 'cucumber' #for rails2
Rails.env ||= ActiveSupport::StringInquirer.new('cucumber') #for rails3
Notice that if you set environment to development in application.rb directly for example, then your tests will run in development.
Also there's another way to set environment to cucumber. If you're running rails with Passenger and Apache for example, then it is possible to run cucumber test in cucumber environment by adding "RailsEnv cucumber"
line to your virtualhost configuration.
When you upgraded to Rails 3, did you perhaps do a global find and replace on RAILS_ENV?
Is the first line of test_helper.rb something other than this?
ENV["RAILS_ENV"] = "test"
In the actual environment variables, it should still be RAILS_ENV, not ::Rails.env, so make sure you don't have ENV["Rails.env"] = "test" for that line of code.
Make sure it looks like it used to. Not that I would know from having made this mistake personally... :-)
On RAILS_ROOT/Gemfile
do: add specific test-only gems to this group:
group :test do
gem 'cucumber-rails'
gem 'capybara'
gem 'database_cleaner'
end
Instead of setting them to be used on development and everywhere else too. This should work.
P.S: edit the code above to set the gems you'll be using for your test, I just copy/pasted the ones Im using on the project I have currently open as an example.