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.