Ошибка Rspec: Diff не является модулем - PullRequest
0 голосов
/ 14 сентября 2011

После Ryan Bates Railscast совершенно новый для rspec.

Я получаю

Guard is now watching at '/Users/thealey/Source/rpd31'
Guard::RSpec is running, with RSpec 2!
Running all specs
/Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/diff-lcs-1.1.3/lib/diff/lcs.rb:3:in `': Diff is not a module (TypeError)
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in `load_dependency'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-expectations-2.6.0/lib/rspec/expectations/differ.rb:1:in `'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in `load_dependency'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-expectations-2.6.0/lib/rspec/expectations.rb:9:in `'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in `load_dependency'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/expecting/with_rspec.rb:1:in `'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in `load_dependency'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:207:in `block in expect_with'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:202:in `each'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:202:in `expect_with'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:184:in `expectation_frameworks'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:413:in `configure_expectation_framework'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:165:in `ensure_example_groups_are_configured'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:178:in `set_it_up'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:141:in `subclass'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:129:in `describe'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/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/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
    from /Users/thealey/.rvm/gems/ruby-1.9.2-p290@rails31/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.

Я поместил diff в свой 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.

1 Ответ

1 голос
/ 17 февраля 2012

У меня была идентичная проблема. В моем случае у меня был класс модели с именем Diff (определенный в diff.rb), что привело к проблеме. Я переименовал свой класс / модуль, и теперь все хорошо. Я несколько разочарован тем, что может произойти такого рода столкновение пространства имен.

Другие пользователи также сталкивались с проблемами, связанными с коллизиями, происходящими из других драгоценных камней (например: https://github.com/sunaku/tork/issues/3).. Если бы я устранял проблему, я бы пошел в ваш каталог драгоценных камней (используйте bundle show для любого вашего драгоценного камня, найди где они живут) и беги

find . -name diff.rb

Это должно сказать вам все библиотеки, которые содержат файл diff.rb. Я искал бы один из более неясных / менее активно поддерживаемых драгоценных камней, чтобы быть виновником. Вам, вероятно, понадобится найти альтернативный драгоценный камень (или внести исправление в оскорбительный драгоценный камень!), Чтобы решить эту проблему.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...