0

编辑:这个问题有时只会发生

这似乎只发生在我从 TextMate 中运行测试时(即使我指定 ruby​​ 用 shebang 手动运行它)。如果我从终端运行它,那么一切都很好......</p>


这是一些代码:

require 'test/unit'
require 'shoulda'

class TestingTest < Test::Unit::TestCase
  context "My thing" do  
    should "always have this test fail, and give me this message" do
      assert false
    end
  end
end

我期待它告诉我类似的信息:

1) Failure:
test: My thing should always have this test fail, and give me this message (TestingTest)
# etc
An assert message, if one was given

但我得到:

1) Failure:
test:8
Failed assertion, no message given.

那么我错过了什么?上面的示例代码很简单,我认为我可以做到,但我看不到问题!

4

1 回答 1

0

尝试继承ActiveSupport::TestCase而不是 Test::Unit::TestCase

于 2010-08-30T19:19:00.717 回答