cucumber/cucumber-rails — Issue #187: Cucumber is failed with funny message
Author: phuongnd08
Created: 2012-01-05 09:45:21+00:00
State: open

I have been used this `env.rb` for quite sometime without any problem. But from some reason, it is failing right now with funny message. I'm using the latest version of cucumber rails. Try reverting to cucumber 1.1.1 doesn't help neither. Here is my env.rb
```ruby
require 'rubygems'
require 'spork'

Spork.prefork do
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
# Avoid routes preload => avoid user.rb preload
require "rails/application"
# avoid routing preload => avoid devise model preload
Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
require File.expand_path("../../../config/environment", __FILE__)
require 'cucumber/rails'
ActiveRecord::Base.connection.disconnect!
end

Spork.each_run do
ActiveRecord::Base.establish_connection

Dir[Rails.root.join("test/support/**/*.rb")].each {|f| require f}

Capybara.default_selector = :css

ActionController::Base.allow_rescue = false

begin
DatabaseCleaner.strategy = :transaction
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

Cucumber::Rails::Database.javascript_strategy = :truncation

end
```

And I'm running my features with: `.rvm/rubies/ruby-1.9.2-p290/bin/ruby -S bundle exec cucumber --profile default`
Which will then raise this error:

```
undefined method `config' for nil:NilClass (NoMethodError)
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-rails-1.2.1/lib/cucumber/rails.rb:17:in `'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/bundler-1.1.rc/lib/bundler/runtime.rb:76:in `require'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/bundler-1.1.rc/lib/bundler/runtime.rb:76:in `rescue in block in require'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/bundler-1.1.rc/lib/bundler/runtime.rb:62:in `block in require'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `each'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `require'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/bundler-1.1.rc/lib/bundler.rb:128:in `require'
/code/my_rails_app/config/application.rb:7:in `'
/code/my_rails_app/config/environment.rb:2:in `require'
/code/my_rails_app/config/environment.rb:2:in `'
/code/my_rails_app/features/support/env.rb:11:in `require'
/code/my_rails_app/features/support/env.rb:11:in `block in '
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/bundler/gems/spork-5119287ae955/lib/spork.rb:24:in `prefork'
/code/my_rails_app/features/support/env.rb:4:in `'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/rb_support/rb_language.rb:129:in `load'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/runtime/support_code.rb:82:in `each'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/runtime.rb:174:in `load_step_definitions'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/runtime.rb:40:in `run!'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/cli/main.rb:43:in `execute!'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/lib/cucumber/cli/main.rb:20:in `execute'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/gems/cucumber-1.1.4/bin/cucumber:14:in `'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/bin/cucumber:19:in `load'
/.rvm/gems/ruby-1.9.2-p290@my_rails_app/bin/cucumber:19:in `

'

```
Any clue?