我似乎无法使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”中查看了代码。待处理方法位于
     除非定义?(规范)
块,但我确认未定义Spec。

提前致谢...

最佳答案

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

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

关于ruby-on-rails-3 - 如何在ActiveSupport中使用Pending模块,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5467481/

10-11 11:59