2

我似乎无法使 ActiveSupport::Testing 中的 Pending 模块工作。

test/unit/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

但是当我执行 ruby​​ unit/foo.rb 时,我得到:

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

我查看了 ActiveSupport gem 中的 pending.rb 中的代码。挂起的方法在一个 unless defined?(Spec) 块内,但我验证了 Spec 没有定义。

提前致谢...

4

1 回答 1

9

pending方法需要在测试中调用,而不是在类上:

test "it works" do
  pending "well, it will eventually"
end
于 2011-03-29T03:16:27.693 回答