狼蛛错误:未初始化的常量Rails

时间:2015-01-19 19:29:21

标签: ruby-on-rails ruby web-crawler

当我跑步时:

rake tarantula:test 

我收到了这些错误:

warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.4-compliant syntax, but you are running 2.1.2.
rm -rf tmp/tarantula
/usr/local/bin/ruby -I"lib:test" -I"/usr/local/lib/ruby/gems/2.1.0/gems/rake-10.2.1/lib" "/usr/local/lib/ruby/gems/2.1.0/gems/rake-10.2.1/lib/rake/rake_test_loader.rb" "test/tarantula/**/*_test.rb" 
Run options: 

# Running tests:

[1/1] TarantulaTest#test_tarantula = 0.00 s
  1) Error:
TarantulaTest#test_tarantula:
NameError: uninitialized constant Rails
    /usr/local/lib/ruby/gems/2.1.0/gems/tarantula-rails3-0.3.3/lib/relevance/tarantula.rb:26:in `rails_root'
    /usr/local/lib/ruby/gems/2.1.0/gems/tarantula-rails3-0.3.3/lib/relevance/tarantula/rails_integration_proxy.rb:15:in `rails_integration_test'
    /usr/local/lib/ruby/gems/2.1.0/gems/tarantula-rails3-0.3.3/lib/relevance/core_extensions/test_case.rb:12:in `tarantula_crawler'
    /usr/local/lib/ruby/gems/2.1.0/gems/tarantula-rails3-0.3.3/lib/relevance/core_extensions/test_case.rb:7:in `tarantula_crawl'
    /beesor/test/tarantula/tarantula_test.rb:26:in `test_tarantula'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:1265:in `run'
    /usr/local/lib/ruby/2.1.0/test/unit/testcase.rb:17:in `run'
    /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-3.2.17/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run'
    /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:414:in `_run__906851432856568922__setup__2846572471353198287__callbacks'
    /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:405:in `__run_callback'
    /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
    /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-3.2.17/lib/active_support/testing/setup_and_teardown.rb:35:in `run'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:940:in `block in _run_suite'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:933:in `map'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:933:in `_run_suite'
    /usr/local/lib/ruby/2.1.0/test/unit.rb:663:in `block in _run_suites'
    /usr/local/lib/ruby/2.1.0/test/unit.rb:661:in `each'
    /usr/local/lib/ruby/2.1.0/test/unit.rb:661:in `_run_suites'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:884:in `_run_anything'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:1092:in `run_tests'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:1079:in `block in _run'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:1078:in `each'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:1078:in `_run'
    /usr/local/lib/ruby/2.1.0/minitest/unit.rb:1066:in `run'
    /usr/local/lib/ruby/2.1.0/test/unit.rb:27:in `run'
    /usr/local/lib/ruby/2.1.0/test/unit.rb:780:in `run'
    /usr/local/lib/ruby/2.1.0/test/unit.rb:372:in `block (2 levels) in autorun'
    /usr/local/lib/ruby/2.1.0/test/unit.rb:33:in `run_once'
    /usr/local/lib/ruby/2.1.0/test/unit.rb:371:in `block in autorun'

Finished tests in 0.031650s, 31.5959 tests/s, 0.0000 assertions/s.
1 tests, 0 assertions, 0 failures, 1 errors, 0 skips

ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
rake aborted!
Command failed with status (1): [ruby -I"lib:test" -I"/usr/local/lib/ruby/gems/2.1.0/gems/rake-10.2.1/lib" "/usr/local/lib/ruby/gems/2.1.0/gems/rake-10.2.1/lib/rake/rake_test_loader.rb" "test/tarantula/**/*_test.rb" ]

Tasks: TOP => tarantula_test
(See full trace by running task with --trace)

这是我简单的 test_tarantula.rb文件

require "relevance/tarantula"

class TarantulaTest < ActionController::IntegrationTest

  def test_tarantula    
    t = tarantula_crawl(self)
  end

end

未初始化的常量Rails 错误是什么意思?

有什么想法吗?

0 个答案:

没有答案