Ruby on rails 运行Rspec时XPath不是模块(类型错误)
由于某些原因,我无法在rspec中运行我的测试。关于堆栈溢出的帖子说这可能是一个名称空间问题,但在我的代码库中(在我的视图中)并没有指出这一点。运行Ruby on rails 运行Rspec时XPath不是模块(类型错误),ruby-on-rails,ruby,rspec,Ruby On Rails,Ruby,Rspec,由于某些原因,我无法在rspec中运行我的测试。关于堆栈溢出的帖子说这可能是一个名称空间问题,但在我的代码库中(在我的视图中)并没有指出这一点。运行rspec spec后,出现以下错误 WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.0 /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/xpath-2
rspec spec
后,出现以下错误
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.0
/Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/xpath-2.0.0/lib/xpath/dsl.rb:1:in `<top (required)>': XPath is not a module (TypeError)
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/xpath-2.0.0/lib/xpath.rb:3:in `require'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/xpath-2.0.0/lib/xpath.rb:3:in `<top (required)>'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/capybara-2.2.1/lib/capybara.rb:3:in `require'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/capybara-2.2.1/lib/capybara.rb:3:in `<top (required)>'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545@global/gems/bundler-1.6.0/lib/bundler/runtime.rb:76:in `require'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545@global/gems/bundler-1.6.0/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545@global/gems/bundler-1.6.0/lib/bundler/runtime.rb:72:in `each'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545@global/gems/bundler-1.6.0/lib/bundler/runtime.rb:72:in `block in require'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545@global/gems/bundler-1.6.0/lib/bundler/runtime.rb:61:in `each'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545@global/gems/bundler-1.6.0/lib/bundler/runtime.rb:61:in `require'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545@global/gems/bundler-1.6.0/lib/bundler.rb:132:in `require'
from /Users/garytsai/Projects/reader-tool/config/application.rb:13:in `<top (required)>'
from /Users/garytsai/Projects/reader-tool/config/environment.rb:2:in `require'
from /Users/garytsai/Projects/reader-tool/config/environment.rb:2:in `<top (required)>'
from /Users/garytsai/Projects/reader-tool/spec/spec_helper.rb:3:in `require'
from /Users/garytsai/Projects/reader-tool/spec/spec_helper.rb:3:in `<top (required)>'
from /Users/garytsai/Projects/reader-tool/spec/controllers/readers_controller_spec.rb:1:in `require'
from /Users/garytsai/Projects/reader-tool/spec/controllers/readers_controller_spec.rb:1:in `<top (required)>'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `each'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22:in `run'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in `run'
from /Users/garytsai/.rvm/gems/ruby-1.9.3-p545/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in `block in autorun'
你试过运行
bundle exec rspec spec
吗?@urigassi我刚试过,同样的错误消息弹出。请注意,我刚才让rspec运行过。当我安装gem或其他东西时,一定发生了一些变化。我安装了ActiveAdmin,但随后卸载了它。这是我能想象的最后一个大变化,它改变了一些东西。
ruby "1.9.3"
gem 'rails', '3.2.14'
gem 'jquery-rails'
gem 'simple_form'
gem 'pg'
gem 'thin'
gem 'XMLCanonicalizer'
gem 'humanize'
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'debugger'
gem 'quiet_assets'
gem 'sextant'
end
group :test do
gem 'capybara'
gem 'selenium-webdriver'
gem 'shoulda-matchers'
gem 'simplecov'
gem 'database_cleaner'
end
group :development, :test do
gem 'rspec-rails'
gem "factory_girl_rails", "~> 4.0"
gem 'faker'
gem "rack_session_access"
gem 'populator'
gem 'dotenv'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'twitter-bootstrap-rails'
gem "less-rails"
gem "therubyracer"
end