Class: Journo::TestRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/journo/test_runner.rb

Overview

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 Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(suite, test) ⇒ TestRunner

Returns a new instance of TestRunner.



13
14
15
16
17
# File 'lib/journo/test_runner.rb', line 13

def initialize(suite, test)
  @suite = suite
  @test = test
  @assertions = 0
end

Instance Attribute Details

#assertions (readonly)

Returns the value of attribute assertions.



11
12
13
# File 'lib/journo/test_runner.rb', line 11

def assertions
  @assertions
end

#exception (readonly)

Returns the value of attribute exception.



11
12
13
# File 'lib/journo/test_runner.rb', line 11

def exception
  @exception
end

#result (readonly)

Returns the value of attribute result.



11
12
13
# File 'lib/journo/test_runner.rb', line 11

def result
  @result
end

#suite (readonly)

Returns the value of attribute suite.



11
12
13
# File 'lib/journo/test_runner.rb', line 11

def suite
  @suite
end

#test (readonly)

Returns the value of attribute test.



11
12
13
# File 'lib/journo/test_runner.rb', line 11

def test
  @test
end

Instance Method Details

#puke(suite, test, exception)



25
26
27
28
29
30
31
# File 'lib/journo/test_runner.rb', line 25

def puke(suite, test, exception)
  case exception
  when MiniTest::Skip then [:skip, exception]
  when MiniTest::Assertion then [:failure, exception]
  else [:error, exception]
  end
end

#run



19
20
21
22
23
# File 'lib/journo/test_runner.rb', line 19

def run
  suite_instance = suite.new(test)
  @result, @exception = fix_result(suite_instance.run(self))
  @assertions = suite_instance._assertions
end