在某些时候,我在运行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 :(得分:0)
原来这是由shoulda
宝石造成的。
答案 1 :(得分:-1)
尝试添加
gem 'test-unit'
到特定组中的Gemfile,然后运行bundle install来安装gem。