2011-03-29 33 views
2

我似乎無法使ActiveSupport :: Testing中的Pending模塊工作。如何使用ActiveSupport中的Pending模塊

測試/單位/ pending.rb包含:

require 'test_helper' 
require 'active_support/testing/pending' 

class PendingTest < ActiveSupport::TestCase 
    include ActiveSupport::Testing::Pending 

    pending "a pending case with a closure" do 
    assert false 
    end 
end 

但是,當我執行紅寶石單位/ foo.rb,我得到:

undefined method `pending' for PendingTest:Class (NoMethodError) 

我看着在代碼中pending.rb在ActiveSupport的寶石。待定方法在 之內,除非定義了?(Spec) 塊,但我確認Spec未定義。

在此先感謝...

回答

9

pending方法需要被調用的測試中,而不是在類:

test "it works" do 
    pending "well, it will eventually" 
end 
+2

酷,謝謝。我認爲我誤導了'pending'方法將塊作爲參數。因此,您仍然可以將測試正文放在未決的塊中。看起來好像塊內部的所有斷言都是*必需*失敗,這是我不會期望的... – mmigdol 2011-03-29 17:53:36

相關問題