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

时间:2013-03-22 14:02:50

标签: rspec testunit

Rspec尝试在运行任何spec文件或整个测试套件的末尾运行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'

1 个答案:

答案 0 :(得分:0)

this page可以回答您的问题

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

Test::Unit.run = true