3

Rspec 尝试在运行任何规范文件或整个测试套件结束时运行 Test::Unit 测试。仍然可以,因为我没有任何测试单元测试文件,但它会尝试将提供给 rspec 的命令行选项传递给 Test::Unit ,这会导致

Finished in 0.54616 seconds
7 examples, 0 failures
invalid option: -O
Test::Unit automatic runner.
Usage: /usr/local/bin/rspec [options] [-- untouched arguments]

-r, --runner=RUNNER              Use the given RUNNER.
                                 (c[onsole], f[ox], g[tk], g[tk]2, t[k])
-n, --name=NAME                  Runs tests matching NAME.
                                 (patterns may be used).
-t, --testcase=TESTCASE          Runs tests in TestCases matching TESTCASE.
                                 (patterns may be used).
-I, --load-path=DIR[:DIR...]     Appends directory list to $LOAD_PATH.
-v, --verbose=[LEVEL]            Set the output level (default is verbose).
                                 (s[ilent], p[rogress], n[ormal], v[erbose])
    --                           Stop processing options so that the
                                 remaining options will be passed to the
                                 test.
-h, --help                       Display this help.

Deprecated options:
    --console                    Console runner (use --runner).
    --gtk                        GTK runner (use --runner).
    --fox                        Fox runner (use --runner).

如何阻止 rspec 运行测试单元测试?

我正在使用的测试宝石版本是

gem 'rspec', '~> 2.7'
gem 'rspec-instafail'
gem 'ci_reporter'
gem 'rspec-rails', '~> 2.7'
gem 'shoulda', :require => false # 2.3.3
gem 'factory_girl', '~> 2.6.4'
gem 'rr'
gem 'timecop'
gem 'rcov'
gem 'database_cleaner'
gem 'webmock', '~> 1.9.3'
gem 'vcr'
gem 'fakeweb', '~> 1.3.0'
gem 'spork', '~> 0.8.0'
gem 'webrat'
4

1 回答 1

0

这个页面有你的问题的答案

临时解决方法是在 env.rb 文件中将 Test::Unit.run 设置为 true:

Test::Unit.run = true 
于 2013-04-02T15:15:53.070 回答