2010-08-30 87 views
0

編輯:這個問題只發生有時單元測試與早該

這纔會出現當我從內TextMate的運行測試(甚至當我指定的紅寶石,從手工用家當運行)發生。如果我從終端運行它,那麼一切都桃色...


下面是一些代碼:

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. 

因此wh我錯過了嗎?上面的示例代碼非常簡單,因爲我認爲我可以做到,而且我看不到問題!

+0

這時候我嘗試過了沒怎麼早該工作繼承。謹慎向我們展示一些代碼? – 2010-08-30 16:11:43

+0

只要注意到它正在按照我期望的方式工作(顯示上下文和失敗時應該顯示的消息)並進行不同的測試 - 必須仔細研究!忍受我和感謝! – 2010-08-30 17:10:42

回答

0

嘗試從ActiveSupport::TestCase而不是測試::單位:: TestCase的