In Files

  • test-unit-3.3.7/lib/test/unit/pending.rb

Methods

Included Modules

Class/Module Index [+]

Quicksearch

Test::Unit::TestCasePendingSupport

Public Class Methods

included(base) click to toggle source
 
               # File test-unit-3.3.7/lib/test/unit/pending.rb, line 58
def included(base)
  base.class_eval do
    include PendingHandler
  end
end
            

Public Instance Methods

pend(message=nil, &block) click to toggle source

Marks the test or part of the test is pending.

Example:

def test_pending
  pend
  # Not reached here
end

def test_pending_with_here
  pend do
    # Ran here
    # Fails if the block doesn't raise any error.
    # Because it means the block is passed unexpectedly.
  end
  # Reached here
end
 
               # File test-unit-3.3.7/lib/test/unit/pending.rb, line 82
def pend(message=nil, &block)
  message ||= "pended."
  if block_given?
    pending = nil
    begin
      yield
    rescue Exception
      pending = Pending.new(name, filter_backtrace(caller), message,
                            :method_name => @method_name)
      add_pending(pending)
    end
    unless pending
      flunk("Pending block should not be passed: #{message}")
    end
  else
    raise PendedError.new(message)
  end
end