I am using a Rails 3.1 application and I was integrating cucumber to my app but when i try to run it I get this strange error, can someone help me please?
Using the default profile...
uninitialized constant ActionController::Dispatcher (NameError)
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-rails-0.3.2/lib/cucumber/rails/action_controller.rb:51:in `rescue in <top (required)>'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-rails-0.3.2/lib/cucumber/rails/action_controller.rb:42:in `<top (required)>'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-rails-0.3.2/lib/cucumber/rails/world.rb:27:in `<top (required)>'
/Users/chinog9/INNKU/tacos/features/support/env.rb:11:in `<top (required)>'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/rb_support/rb_language.rb:143:in `load'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/rb_support/rb_language.rb:143:in `load_code_file'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/runtime/support_code.rb:176:in `load_file'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/runtime/support_code.rb:78:in `block in load_files!'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/runtime/support_code.rb:77:in `each'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/runtime/support_code.rb:77:in `load_files!'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:137:in `load_step_definitions'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:39:in `run!'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/cli/main.rb:43:in `execute!'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/cli/main.rb:20:in `execute'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/bin/cucumber:14:in `<top (required)>'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/bin/cucumber:19:in `load'
/Users/chinog9/.rvm/gems/ruby-1.9.2-p180/bin/cucumber:19:in `<main>'
Here is my env.rb:
ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
require 'cucumber/rails/world'
require 'cucumber/rails/active_record'
require 'cucumber/web/tableish'
require 'capybara/rails'
require 'capybara/cucumber'
require 'capybara/session'
require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
Capybara.default_selector = :css
ActionController::Base.allow_rescue = false
Cucumber::Rails::World.use_transactional_fixtures = true
if defined?(ActiveRecord::Base)
begin
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation
rescue LoadError => ignore_if_database_cleaner_not_present
end
end
And here is my Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.0.rc4'
gem 'sqlite3'
gem 'nifty-generators'
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
gem 'ruby-debug19', :require => 'ruby-debug'
group :development, :test do
gem 'capybara'
gem 'database_cleaner'
gem 'cucumber-rails'
gem 'cucumber'
gem 'rspec-rails', '>=2.6'
gem 'rspec-rails-mocha'
gem 'spork', '~> 0.9.0.rc'
gem 'factory_girl_rails'
gem 'launchy'
gem "ruby-debug19"
gem 'turn', :require => false
gem "selenium-client"
end
gem "mocha", :group => :test
Thanks! :)
I had a same issue and solved upgrading cucumber-rails to 1.0.5. Try this in Gemfile.
gem "cucumber-rails", "1.0.5"
And rerun installer
script/rails g cucumber:install your-language --your-options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With