我在使用Rspec 1.3的rails 2.3.8應用程序中設置水豚(0.4.1.2)時遇到了一些麻煩從安裝水豚指令我插入了行:安裝Capybara for Rails 2.3和Rspec
require 'capybara/rspec'
但是,這給了我一個不斷的錯誤。似乎它正在尋找一個沒有加載的類「RSpec」(我猜這是一個RSpec 2/Rails 3的東西)。
那麼如何讓Rspec在rails 2.3下識別水豚?我應該使用較早版本的capy?
PS。這裏的回溯的一個片段:
/Users/rafe/.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/dependencies.rb|443| in `load_missing_constant': uninitialized constant RSpec (NameError)
/Users/rafe/.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/dependencies.rb|80| in `const_missing_not_from_s3_library'
/Users/rafe/.rvm/gems/[email protected]/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb|206| in `const_missing'
/Users/rafe/.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/dependencies.rb|92| in `const_missing'
|| from /Users/rafe/.rvm/gems/[email protected]/gems/capybara-0.4.1.2/lib/capybara/rspec.rb:4
/Users/rafe/.rvm/gems/[email protected]/gems/rails-2.3.5/lib/rails/gem_dependency.rb|119| Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
/Users/rafe/.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/dependencies.rb|443| in `load_missing_constant': uninitialized constant RSpec (NameError)
/Users/rafe/.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/dependencies.rb|80| in `const_missing_not_from_s3_library'
/Users/rafe/.rvm/gems/[email protected]/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb|206| in `const_missing'
/Users/rafe/.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/dependencies.rb|92| in `const_missing'
| from /Users/rafe/.rvm/gems/[email protected]/gems/capybara-0.4.1.2/lib/capybara/rspec.rb:4
/Users/rafe/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb|31| in `gem_original_require'
/Users/rafe/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb|31| in `require'
/Users/rafe/.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/dependencies.rb|158| in `require'
|| from /Users/rafe/cmi/lci/branches/forums/spec/spec_helper.rb:12
我收到此錯誤:未初始化的常量水豚:: DSL(NameError) – RAJ 2012-07-24 11:50:48
我建議在你的spec_helper.rb上進行一些調試... 我認爲這可能是因爲我們已經在這個rails 2.3項目上使用了bundler,所以Bundler可能會要求水豚自動爲我... 看看Capybara文檔,看看哪些文件需要水豚/ dsl,也許'需要'capybara''頂部spec_helper.rb wil我做的訣竅 – 2012-07-25 15:11:03
這對我來說很好,謝謝 – 2012-10-08 20:51:11