Cucumber-rails 0.4.0 was released for Rails 3.x. If you try to use it with anything below that (Rails 2.3.x), you’ll encounter the error:
uninitialized constant Rack::Test (NameError)
Is the rack-test driver missing? Nope. Well you still need that installed but the root cause of the breakage is lack of a proper test environment for Rails 2.3 whereas Rails 3.0 has this covered.
The solution? Simple.
Use an older version of cucumber. If you missed that from the first two sentences of the post then… :(.
For me it works using this configuration for the config/cucumber.rb file (that’s our environment file, you can also opt to place this in your test.rb file instead):
config.gem 'cucumber-rails', :lib => false, :version => '0.3.2'
or if you’re using bundler:
gem "cucumber-rails", "~> 0.3.2"
or if you’re really lazy and don’t have anything to automatically install gems for your environment:
gem install cucumber-rails -v=0.3.2