Почему минимальный сбой перед запуском тестов в Rails 2.3.9? - PullRequest
0 голосов
/ 05 ноября 2011

Я пытаюсь обновить приложение Rails 2.3.9 для работы с Ruby 1.9.2-p290;ранее приложение работало с Ruby 1.8.7.Я замечаю несколько причуд, самое замечательное в том, что я не могу запустить какие-либо тесты в своем приложении - не отдельные тесты и не тесты рейка.

minitest выдает ошибку перед выполнением любого теста:

undefined method `name' for ActionView::TestCase.

Полная трассировка стека следует.

$ bundle exec rake test:units
WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
    at /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
/Users/me/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -I"lib:test" -I"/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib" "/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/unit/**/*_test.rb" 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/rails-2.3.9/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#refresh! called from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/rails-2.3.9/lib/rails/vendor_gem_source_index.rb:34.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#load_gems_in called from /Users/me/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:322.
Run options: --seed 48289

# Running tests:

EEEE/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.9/lib/action_controller/test_process.rb:511:in `method_missing': undefined method `name' for #<ActionView::TestCase:0x007fa0ee39ece8> (NoMethodError)
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.9/lib/action_view/test_case.rb:158:in `method_missing'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-2.3.9/lib/active_support/testing/setup_and_teardown.rb:26:in `rescue in run'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-2.3.9/lib/active_support/testing/setup_and_teardown.rb:33:in `run'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:812:in `block in _run_suite'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:805:in `map'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:805:in `_run_suite'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:795:in `block in _run_suites'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:795:in `map'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:795:in `_run_suites'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:771:in `_run_anything'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:934:in `run_tests'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:921:in `block in _run'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:920:in `each'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:920:in `_run'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:909:in `run'
    from /Users/me/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.7.0/lib/minitest/unit.rb:689:in `block in autorun'
Run options: --seed 52971

# Running tests:

1 Ответ

0 голосов
/ 18 ноября 2011

Оказывается, моя окружающая среда была плохой: я использовал ruby ​​1.8.7, но мои GEM PATHS указывали на ruby ​​1.9.2.

...