Sha256: 26e87f9a1e9fa2156b9b142a8623b154f78cf618c19787015d84228e01b39acc

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

# This file contains a few overrides of Test::Unit behavior that are
# either necessary for the contract library to work correctly or that
# make things a bit more comfortable to use.


class Contract < Test::Unit::TestCase
  # The resulting suite() should pass along additional parameters that
  # are given to the suite.run method so we can supply a specific Object
  # to run the test suite against.
  def self.suite() # :nodoc:
    result = super()
    def result.run(result, *more, &progress_block)
      progress_block ||= lambda { |*args| }
      progress_block.call(STARTED, name)
      @tests.each do |test|
        test.run(result, *more, &progress_block)
      end
      progress_block.call(FINISHED, name)
    end
    return result
  end

  # We need to run the test suite against a specific Object.
  def run(result, object) # :nodoc:
    @object = object
    super(result)
  end

  # Having empty contracts makes sense and is not an unexpected situation.
  def default_test() # :nodoc:
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carats-0.3.0 lib/carat-dev/interface_work/contracts/contract/lib/contract/overrides.rb