Module: Test::Unit::TestCasePendingSupport
- Included in:
- TestCase
- Defined in:
- lib/test/unit/pending.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#pend(message = nil, &block) ⇒ Object
Marks the test or part of the test is pending.
Class Method Details
.included(base) ⇒ Object
58 59 60 61 62 |
# File 'lib/test/unit/pending.rb', line 58 def included(base) base.class_eval do include PendingHandler end end |
Instance Method Details
#pend(message = nil, &block) ⇒ Object
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
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/test/unit/pending.rb', line 82 def pend(=nil, &block) ||= "pended." if block_given? pending = nil begin yield rescue Exception pending = Pending.new(name, filter_backtrace(caller), , :method_name => @method_name) add_pending(pending) end unless pending flunk("Pending block should not be passed: #{}") end else raise PendedError.new() end end |