我对此错误感到非常困惑。如果Capybara没有错过常数,为什么它会抱怨?
背景
我正在升级Rails应用程序,现在正在运行Rails 3.0.7和Ruby 1.9.3。我升级到了Cucumber 1.1.2,经过一些挑剔的工作和乱跑,我的所有测试都运行良好。然后我尝试升级Rspec以使这些测试运行。再一次,随着一些人在圈子里跑来跑去,我设法让Rspec测试与&#rs; rspec'一起运行。 3.2.0和Capybara 2.2.0。
是的我!
然后我回到Cucumber测试来检查一些东西,然后...... BAM 。黄瓜测试被打破了一个非常奇怪的错误信息......
Capybara is not missing constant RackTest! (ArgumentError)
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:479:in `load_missing_constant'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:183:in `block in const_missing'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:181:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:181:in `const_missing'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-rails-0.4.1/lib/cucumber/rails/capybara/javascript_emulation.rb:67:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:227:in `load_dependency'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-rails-0.4.1/lib/cucumber/rails/capybara.rb:5:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:227:in `load_dependency'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-rails-0.4.1/lib/cucumber/rails.rb:10:in `<top (required)>'
/Users/camillavk/Documents/Work/Saild/saild/features/support/env.rb:7:in `require'
/Users/camillavk/Documents/Work/Saild/saild/features/support/env.rb:7:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/rb_support/rb_language.rb:143:in `load'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/rb_support/rb_language.rb:143:in `load_code_file'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:82:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime.rb:137:in `load_step_definitions'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime.rb:39:in `run!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/cli/main.rb:43:in `execute!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/cli/main.rb:20:in `execute'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/bin/cucumber:14:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/cucumber:23:in `load'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/cucumber:23:in `<main>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/ruby_executable_hooks:15:in `eval'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/ruby_executable_hooks:15:in `<main>'
为什么黄瓜不能再跑了?我认为这是因为我升级了Capybara,但我认为黄瓜栏已经有了水豚,所以我认为这不应该影响它吗?
以下是我的gemfile的相关部分:
group :development, :test do
gem 'test-unit', '1.2.3'
# gem 'rspec', '1.3.2'
gem 'rspec-rails', '3.2.0'
end
group :test do
gem 'capybara', '2.2.0'
gem 'cucumber', '1.1.2'
gem 'cucumber-rails', :require => false
gem 'database_cleaner'
end
如果是因为升级Capybara,我必须降级到什么版本的Capybara才能让我的Cucumber和Rspec测试能够运行?
答案 0 :(得分:0)
您是否尝试过松开宝石的版本?不需要在gemfile中固定版本,因为gemfile.lock已经确保在任何地方都安装了相同的版本。如果存在错误或不兼容问题,您应该只修复版本。这样做时,请尝试说明固定的原因。
如果您选择固定版本,请尝试在补丁级别上放松它们。
group :development, :test do
gem 'test-unit', '~> 1.2.3'
gem 'rspec-rails', '~> 3.2.0'
end
group :test do
gem 'capybara', '~> 2.2.0'
gem 'cucumber', '~> 1.1.2'
gem 'cucumber-rails', :require => false
gem 'database_cleaner'
end