Included Modules

Class Index [+]

Quicksearch

Test::Unit::TestCaseOmissionSupport

Public Class Methods

included(base) click to toggle source
    # File lib/test/unit/omission.rb, line 56
56:         def included(base)
57:           base.class_eval do
58:             include OmissionHandler
59:           end
60:         end

Public Instance Methods

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

Omit the test or part of the test.

Example:

  def test_omission
    omit
    # Not reached here
  end

  def test_omission_with_here
    omit do
      # Not ran here
    end
    # Reached here
  end
    # File lib/test/unit/omission.rb, line 77
77:       def omit(message=nil, &block)
78:         message ||= "omitted."
79:         if block_given?
80:           omission = Omission.new(name, filter_backtrace(caller), message)
81:           add_omission(omission)
82:         else
83:           raise OmittedError.new(message)
84:         end
85:       end
omit_if(condition, *args, &block) click to toggle source

Omit the test or part of the test if condition is true.

Example:

  def test_omission
    omit_if("".empty?)
    # Not reached here
  end

  def test_omission_with_here
    omit_if(true) do
      # Not ran here
    end
    omit_if(false) do
      # Reached here
    end
    # Reached here too
  end
     # File lib/test/unit/omission.rb, line 105
105:       def omit_if(condition, *args, &block)
106:         if condition
107:           omit(*args, &block)
108:         else
109:           block.call if block
110:         end
111:       end
omit_unless(condition, *args, &block) click to toggle source

Omit the test or part of the test if condition is not true.

Example:

  def test_omission
    omit_unless("string".empty?)
    # Not reached here
  end

  def test_omission_with_here
    omit_unless(true) do
      # Reached here
    end
    omit_unless(false) do
      # Not ran here
    end
    # Reached here too
  end
     # File lib/test/unit/omission.rb, line 131
131:       def omit_unless(condition, *args, &block)
132:         if condition
133:           block.call if block
134:         else
135:           omit(*args, &block)
136:         end
137:       end

Private Instance Methods

add_omission(omission) click to toggle source
     # File lib/test/unit/omission.rb, line 140
140:       def add_omission(omission)
141:         current_result.add_omission(omission)
142:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.