2013-02-04 73 views
0

ruby​​類中的我的代碼是。在這裏我得到未初始化的常量ActionDispatch(NameError)在Ruby中未初始化的常量ActionDispatch(NameError)

DatabaseCleaner.strategy = :transaction 
class ActionDispatch::IntegrationTest 
    # Make the Capybara DSL available in all integration tests 
    include Capybara::DSL 

    # Stop ActiveRecord from wrapping tests in transactions 
    self.use_transactional_fixtures = false 

    teardown do 
     DatabaseCleaner.clean  # Truncate the database 
     Capybara.reset_sessions! # Forget the (simulated) browser state 
     Capybara.use_default_driver 
    end 
end 
+0

這是什麼代碼?什麼版本的導軌? –

+0

我寫這篇文章是針對黃瓜測試用例的。它在test_helper.rb 我正在使用Rails 3.1.0 –

+0

也許粘貼你的整個test_helper.rb。你沒有用上面的代碼替換它中的所有代碼嗎? – rainkinz

回答

0

升級後,我遇到了同樣的問題。

這是我的堆棧跟蹤:

uninitialized constant ActionDispatch::IntegrationTest (NameError) 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-rails-1.3.1/lib/cucumber/rails/world.rb:9:in `<module:Rails>' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-rails-1.3.1/lib/cucumber/rails/world.rb:8:in `<module:Cucumber>' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-rails-1.3.1/lib/cucumber/rails/world.rb:7:in `<top (required)>' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/backports-3.3.0/lib/backports/tools.rb:328:in `require' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/backports-3.3.0/lib/backports/tools.rb:328:in `require_with_backports' 
/Users/etagwerker/Projects/om/features/support/env.rb:11:in `<top (required)>' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/lib/cucumber/rb_support/rb_language.rb:122:in `load' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/lib/cucumber/rb_support/rb_language.rb:122:in `load_code_file' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/lib/cucumber/runtime/support_code.rb:180:in `load_file' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/lib/cucumber/runtime/support_code.rb:82:in `each' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/lib/cucumber/runtime/support_code.rb:82:in `load_files!' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/lib/cucumber/runtime.rb:183:in `load_step_definitions' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/lib/cucumber/runtime.rb:42:in `run!' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/lib/cucumber/cli/main.rb:47:in `execute!' 
/Users/etagwerker/.rvm/gems/[email protected]/gems/cucumber-1.3.1/bin/cucumber:13:in `<top (required)>' 
script/cucumber:9:in `load' 
script/cucumber:9:in `<main>' 

我使用rails 3.0.20和1.3.1 cucumber-rails

嘗試一些事情之後,我嘗試這樣做:

rails generate cucumber:install 

這解決了這個問題對我來說。

相關問題