我正在向我的 Rails 应用程序添加一个新的(普通旧的)ruby 类。我对该课程进行了最小的单元测试:
require 'minitest_helper'
class ReportOptionTest < MiniTest::Unit::TestCase
def setup
@report_option = Cmdx::ReportGenerator::ReportOption.new( "testing123" )
end
def test_depends_on
assert @report_option.depends_on.empty?
end
end
如果我只通过 rake 运行这个测试,它会像我预期的那样运行,但它运行了六次,而我没有:
$ time rake test TEST=test/unit/report_generator/report_option_test.rb
Rack::File headers parameter replaces cache_control after Rack 1.5.
Run options: --seed 64427
# Running tests:
.
Finished tests in 0.003272s, 305.6309 tests/s, 305.6309 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
Rack::File headers parameter replaces cache_control after Rack 1.5.
Run options: --seed 17980
# Running tests:
.
Finished tests in 0.003284s, 304.4809 tests/s, 304.4809 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
Rack::File headers parameter replaces cache_control after Rack 1.5.
Run options: --seed 45845
# Running tests:
.
Finished tests in 0.003267s, 306.0590 tests/s, 306.0590 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
Rack::File headers parameter replaces cache_control after Rack 1.5.
Run options: --seed 49526
# Running tests:
.
Finished tests in 0.003258s, 306.9620 tests/s, 306.9620 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
Rack::File headers parameter replaces cache_control after Rack 1.5.
Run options: --seed 53716
# Running tests:
.
Finished tests in 0.003246s, 308.1155 tests/s, 308.1155 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
Rack::File headers parameter replaces cache_control after Rack 1.5.
Run options: --seed 44898
# Running tests:
.
Finished tests in 0.003272s, 305.6556 tests/s, 305.6556 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
real 0m34.999s
user 0m32.034s
sys 0m1.440s
我注意到这个页面提到了一个类似的问题。我不明白发生了什么,以及是否需要更改一些配置设置以仅运行一次测试,并且坦率地说,让运行测试更快地完成。
版本:
$ ruby -v
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]
$ rake -V
rake, version 10.0.3
$ rails -v
Rails 3.2.12