mmigdol
mmigdol

Reputation: 2203

How to use the Pending module in ActiveSupport

I can't seem to make the Pending module in ActiveSupport::Testing work.

test/unit/pending.rb contains:

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

But when I execute ruby unit/foo.rb, I get:

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

I looked in the code in pending.rb in the ActiveSupport gem. The pending method is inside an unless defined?(Spec) block, but I verified that Spec is not defined.

Thanks in advance...

Upvotes: 3

Views: 2480

Answers (1)

Ryan Bigg
Ryan Bigg

Reputation: 107728

the pending method needs to be called inside a test, rather than on the class:

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

Upvotes: 10

Related Questions