Class: SolargraphTestCoverage::TestRunner

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

Overview

Parent Class for different testing frameworks

Direct Known Subclasses

MinitestRunner, RSpecRunner

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_file) ⇒ TestRunner

Returns a new instance of TestRunner.



15
16
17
18
19
# File 'lib/solargraph_test_coverage/test_runner.rb', line 15

def initialize(test_file)
  @test_file = test_file
  @result    = nil
  @output    = StringIO.new
end

Class Method Details

.with(test_file) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/solargraph_test_coverage/test_runner.rb', line 6

def self.with(test_file)
  case Config.test_framework
  when 'rspec'
    RSpecRunner.new(test_file)
  when 'minitest'
    MinitestRunner.new(test_file)
  end
end

Instance Method Details

#failed_examplesObject

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/solargraph_test_coverage/test_runner.rb', line 26

def failed_examples
  raise NotImplementedError
end

#passed?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/solargraph_test_coverage/test_runner.rb', line 30

def passed?
  raise NotImplementedError
end

#run!Object



21
22
23
24
# File 'lib/solargraph_test_coverage/test_runner.rb', line 21

def run!
  @result = test_framework_runner.run(test_options, $stderr, @output)
  self
end