0

在某些时候,我开始在运行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'
4

2 回答 2

0

原来这是由shoulda宝石引起的。

于 2012-10-21T03:41:33.090 回答
-1

尝试添加

gem 'test-unit'

到特定组中的 Gemfile,然后运行 ​​bundle install 来安装 gem。

于 2012-07-26T13:36:46.270 回答