-1

在 rails 3.2/minitest 项目中第一次调用“skip”时出现未定义的错误。

require "test_helper"

describe "Test Integration Test" do
  describe "area1" do
    it "must do X" do
      assert true
    end
    it "must do Y" do
      assert true
    end
  end
end

这很好用,但是如果我修改为跳过 Y ...

    it "must do Y" do
      skip "need to rewrite"
      assert true
    end

...它错误:

$ rake test:integration
Run options: --seed 49388

.E

Finished tests in 2.109235s, 6.6375 tests/s, 12.8008 assertions/s.
# Running tests:

  1) Error:
test_0003_must_do_y(Test Integration Test::area1):
NoMethodError: undefined method `split' for nil:NilClass
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/testing/setup_and_teardown.rb:35:in `block in run'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:425:in `_run__858522010476008514__setup__95624718422814153__callbacks'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/testing/setup_and_teardown.rb:34:in `run'

如果我添加第三个测试,也跳过,它只会在第一个跳过时报告错误:

require "test_helper"

describe "Test Integration Test" do
  describe "area1" do
    it "must do X" do
      assert true
    end
    it "must do Y" do
      skip "rewrite me"
      assert true
    end
    it "must do Z" do
      skip "rewrite me"
      assert true
    end
  end
end


$ rake test:integration
Run options: --seed 43718

# Running tests:

ES.

Finished tests in 2.236945s, 6.2585 tests/s, 11.6230 assertions/s.

  1) Error:
test_0003_must_do_z(Test Integration Test::area1):
NoMethodError: undefined method `split' for nil:NilClass
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/testing/setup_and_teardown.rb:35:in `block in run'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:425:in `_run__2453774402805069296__setup__401473829290905838__callbacks'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/drew/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/testing/setup_and_teardown.rb:34:in `run'

任何人都可以就第一次遇到的跳过错误的原因提出建议吗?或者,也许,我应该在哪个问题跟踪器中提交这个问题?

4

1 回答 1

0

我对此进行了调试,发现错误来自我正在使用的 minitest-rg gem。万一其他人遇到这个问题,我在一个分支中对其进行了修补并向维护者发送了一个拉取请求

于 2012-06-12T15:43:33.497 回答