2011-09-13 66 views
0

繼瑞安貝茨railscast全新rspec。Rspec錯誤:差異不是模塊

我得到

 
Guard is now watching at '/Users/thealey/Source/rpd31' 
Guard::RSpec is running, with RSpec 2! 
Running all specs 
/Users/thealey/.rvm/gems/[email protected]/gems/diff-lcs-1.1.3/lib/diff/lcs.rb:3:in `': Diff is not a module (TypeError) 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in `load_dependency' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-expectations-2.6.0/lib/rspec/expectations/differ.rb:1:in `' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in `load_dependency' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-expectations-2.6.0/lib/rspec/expectations.rb:9:in `' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in `load_dependency' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/expecting/with_rspec.rb:1:in `' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in `load_dependency' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:207:in `block in expect_with' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:202:in `each' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:202:in `expect_with' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:184:in `expectation_frameworks' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:413:in `configure_expectation_framework' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:165:in `ensure_example_groups_are_configured' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:178:in `set_it_up' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:141:in `subclass' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:129:in `describe' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/dsl.rb:5:in `describe' 
    from /Users/thealey/Source/rpd31/spec/requests/create_projects_spec.rb:3:in `' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run' 
    from /Users/thealey/.rvm/gems/[email protected]/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun' 

的Gemfile是

source 'http://rubygems.org' 

gem 'rails', '3.0.10' 


gem 'mysql2', '0.2.7' 


gem "authlogic" 
gem 'activesupport', '3.0.10' 
gem 'cancan' 
gem 'will_paginate', "~> 3.0" 
gem 'calendar_date_select', :git => 'http://github.com/paneq/calendar_date_select.git', :branch => 'rails3test' 
gem 'bluecloth' 
gem 'rdiscount' 
gem 'capybara' 
gem 'paperclip' 
gem 'mail' 

有關如何解決這個知道的任何想法。

編輯:我刪除了從Gemfile註釋掉的行。

我把差異放入我的gemfile沒有改變。

這是捆綁的輸出。

 
Using rake (0.9.2) 
Using abstract (1.0.0) 
Using activesupport (3.0.10) 
Using builder (2.1.2) 
Using i18n (0.5.0) 
Using activemodel (3.0.10) 
Using erubis (2.6.6) 
Using rack (1.2.3) 
Using rack-mount (0.6.14) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.29) 
Using actionpack (3.0.10) 
Using mime-types (1.16) 
Using polyglot (0.3.2) 
Using treetop (1.4.10) 
Using mail (2.2.19) 
Using actionmailer (3.0.10) 
Using arel (2.0.10) 
Using activerecord (3.0.10) 
Using activeresource (3.0.10) 
Using addressable (2.2.6) 
Using archive-tar-minitar (0.5.2) 
Using authlogic (3.0.3) 
Using crack (0.1.8) 
Using httparty (0.7.8) 
Using multipart-post (1.1.3) 
Using faraday (0.7.4) 
Using multi_json (1.0.3) 
Using oauth2 (0.5.0) 
Using bitly (0.6.1) 
Using bluecloth (2.1.0) 
Using bson (1.3.1) 
Using bson_ext (1.3.1) 
Using bundler (1.0.18) 
Using calendar_date_select (1.16.1) from http://github.com/paneq/calendar_date_select.git (at rails3test) 
Using cancan (1.6.5) 
Using nokogiri (1.5.0) 
Using ffi (1.0.9) 
Using childprocess (0.2.2) 
Using json_pure (1.6.0) 
Using rubyzip (0.9.4) 
Using selenium-webdriver (2.5.0) 
Using xpath (0.1.4) 
Using capybara (1.1.1) 
Using chronic (0.6.4) 
Using cocaine (0.2.0) 
Using colored (1.2) 
Using columnize (0.3.4) 
Using daemons (1.1.4) 
Using diff (0.3.6) 
Using diff-lcs (1.1.3) 
Using eventmachine (0.12.10) 
Using factory_girl (2.1.0) 
Using rdoc (3.9.4) 
Using thor (0.14.6) 
Using railties (3.0.10) 
Using factory_girl_rails (1.2.0) 
Using git_remote_branch (0.3.0) 
Using googlecharts (1.6.7) 
Using gravtastic (3.2.6) 
Using guard (0.6.3) 
Using guard-rspec (0.4.5) 
Using htmldiff (0.0.1) 
Using ruby_core_source (0.1.5) 
Using linecache19 (0.5.12) 
Using mysql2 (0.2.7) 
Using net-ldap (0.2.2) 
Using net-ping (1.5.0) 
Using paperclip (2.4.1) 
Using rails (3.0.10) 
Using rdiscount (1.6.8) 
Using ri_cal (0.8.8) 
Using riddle (1.4.0) 
Using rspec-core (2.6.4) 
Using rspec-expectations (2.6.0) 
Using rspec-mocks (2.6.0) 
Using rspec (2.6.0) 
Using rspec-rails (2.6.1) 
Using ruby-debug-base19 (0.11.25) 
Using ruby-debug19 (0.11.6) 
Using seed_dump (0.3.4) 
Using thin (1.2.11) 
Using thinking-sphinx (2.0.1) 
Using time_diff (0.2.1) 
Using will_paginate (3.0.pre) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. 
+0

您是否嘗試安裝Gem for Diff? –

+0

隨意刪除不相關的行,就像你不包括的寶石一樣。 –

回答

1

我有同樣的問題。在我的情況下,我有一個名爲Diff的模型類(在diff.rb中定義)導致該問題。我已經重新命名了我的班級/模塊,現在一切都很順利。我對這種命名空間碰撞可能發生有些失望。

其他用戶也遇到了來自其他寶石的碰撞問題(例如:https://github.com/sunaku/tork/issues/3)。如果我解決該問題,我會去你的寶石目錄(使用捆綁秀你的寶石中的任何一個找到他們居住的地方),然後運行

find . -name diff.rb

這應該告訴你的所有庫包含diff.rb文件。我會尋找一個比較模糊/不那麼積極的維護寶石成爲罪魁禍首。你可能需要找到一個替代寶石(或者貢獻一個修復有問題的寶石!)來解決這個問題。