2012-07-19 50 views
0

在某些時候,我開始在運行rake任務時獲得測試輸出,我不知道爲什麼。運行Rake加載它的測試套件?

$ rake -T 
(task output) 
Loaded suite /Users/tsigo/.rbenv/versions/1.9.2-p290/bin/rake 
Started 

Finished in 0.000398 seconds. 

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips 

Test run options: --seed 30951 

而且rails c是古怪的行爲,以及:

$ rails c 
Loading development environment (Rails 3.1.6) 
irb(main):002:0> Rails.version 
=> "3.1.6" 
irb(main):003:0> RUBY_VERSION 
=> "1.9.2" 
irb(main):004:0> exit 
/Users/tsigo/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/minitest/unit.rb:581:in `block in process_args': invalid option: --rubygems (OptionParser::InvalidOption) 
    from /Users/tsigo/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/minitest/unit.rb:560:in `new' 
    from /Users/tsigo/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/minitest/unit.rb:560:in `process_args' 
    from /Users/tsigo/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/minitest/unit.rb:591:in `run' 
    from /Users/tsigo/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/minitest/unit.rb:508:in `block in autorun' 

最後,在我的RSpec套件,如果有一個失敗,它不顯示文件和行信息,使得任何輸出幾乎沒用:

Failures: 

    1) Test 
    Failure/Error: false.should be_true 
     expected: true 
      got: false 
~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_formatter.rb:16:in `expand_path': No such file or directory - getcwd (Errno::ENOENT) 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_formatter.rb:16:in `relative_path' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_formatter.rb:126:in `backtrace_line' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_formatter.rb:114:in `block in format_backtrace' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_formatter.rb:114:in `map' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_formatter.rb:114:in `format_backtrace' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_text_formatter.rb:154:in `dump_backtrace' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_text_formatter.rb:20:in `block in dump_failures' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_text_formatter.rb:17:in `each' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_text_formatter.rb:17:in `each_with_index' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/formatters/base_text_formatter.rb:17:in `dump_failures' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:98:in `block in notify' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:97:in `each' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:97:in `notify' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:81:in `finish' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:36:in `report' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:25:in `run' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run' 
    from ~/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun' 

回答

0

原來這是由shoulda寶石造成的。

-1

嘗試添加

gem 'test-unit' 

添加到特定組中的Gemfile,然後運行bundle install來安裝gem。