Sha256: b77775b644800d682578a5753cea0b267a4b7e7784454d6b6ce935129480a4be

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module MiniTest
  # Runner for individual MiniTest tests.
  # 
  # You *should not* create instances of this class directly. Instances of
  # {SuiteRunner} will create these and send them to the reporters.
  # 
  # Based upon Ryan Davis of Seattle.rb's MiniTest (MIT License).
  # 
  # @see https://github.com/seattlerb/minitest MiniTest
  class TestRunner
    attr_reader :suite, :test, :assertions, :result, :exception, :options
    
    def initialize(suite, test)
      @suite = suite
      @test = test
      @assertions = 0
    end
    
    def run
      suite_instance = suite.new(test)
      @result, @exception = fix_result(suite_instance.run(self))
      @assertions = suite_instance._assertions
    end
    
    def puke(suite, test, exception)
      case exception
      when MiniTest::Skip then [:skip, exception]
      when MiniTest::Assertion then [:failure, exception]
      else [:error, exception]
      end
    end
    
    private
    
    def fix_result(result)
      result == '.' ? [:pass, nil] : result
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
minitest-reporters-0.7.1 lib/minitest/test_runner.rb
minitest-reporters-0.7.0 lib/minitest/test_runner.rb
minitest-reporters-0.6.0 lib/minitest/test_runner.rb
minitest-reporters-0.5.1 lib/minitest/test_runner.rb