Class: CI::Reporter::Spinach

Inherits:
Spinach::Reporter
  • Object
show all
Includes:
SpinachVersion
Defined in:
lib/ci/reporter/spinach.rb

Constant Summary

Constants included from SpinachVersion

CI::Reporter::SpinachVersion::VERSION

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ Spinach

Returns a new instance of Spinach.



10
11
12
13
# File 'lib/ci/reporter/spinach.rb', line 10

def initialize(options = nil)
  @options = options
  @report_manager = ReportManager.new('features')
end

Instance Method Details

#after_feature_run(feature) ⇒ Object



43
44
45
46
47
# File 'lib/ci/reporter/spinach.rb', line 43

def after_feature_run(feature)
  @test_suite.finish
  @report_manager.write_report(@test_suite)
  @test_suite = nil
end

#after_scenario_run(scenario, step_definitions = nil) ⇒ Object



37
38
39
40
41
# File 'lib/ci/reporter/spinach.rb', line 37

def after_scenario_run(scenario, step_definitions = nil)
  @test_case.finish
  @test_suite.testcases << @test_case
  @test_case = nil
end

#before_feature_run(feature) ⇒ Object



15
16
17
18
# File 'lib/ci/reporter/spinach.rb', line 15

def before_feature_run(feature)
  @test_suite = TestSuite.new(feature.is_a?(Hash) ? feature['name'] : feature.name)
  @test_suite.start
end

#before_scenario_run(scenario, step_definitions = nil) ⇒ Object



20
21
22
23
# File 'lib/ci/reporter/spinach.rb', line 20

def before_scenario_run(scenario, step_definitions = nil)
  @test_case = TestCase.new(scenario.is_a?(Hash) ? scenario['name'] : scenario.name)
  @test_case.start
end

#on_error_step(step, failure, step_location, step_definitions = nil) ⇒ Object



33
34
35
# File 'lib/ci/reporter/spinach.rb', line 33

def on_error_step(step, failure, step_location, step_definitions = nil)
  @test_case.failures << SpinachFailure.new(:error, step, failure, step_location)
end

#on_failed_step(step, failure, step_location, step_definitions = nil) ⇒ Object



29
30
31
# File 'lib/ci/reporter/spinach.rb', line 29

def on_failed_step(step, failure, step_location, step_definitions = nil)
  @test_case.failures << SpinachFailure.new(:failed, step, failure, step_location)
end

#on_undefined_step(step, failure, step_definitions = nil) ⇒ Object



25
26
27
# File 'lib/ci/reporter/spinach.rb', line 25

def on_undefined_step(step, failure, step_definitions = nil)
  @test_case.failures << SpinachFailure.new(:error, step, failure, nil)
end