Class: CI::Reporter::Spinach

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

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ Spinach

Returns a new instance of Spinach.



7
8
9
10
# File 'lib/ci/reporter/spinach.rb', line 7

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

Instance Method Details

#after_feature_run(feature) ⇒ Object



40
41
42
43
44
# File 'lib/ci/reporter/spinach.rb', line 40

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



34
35
36
37
38
# File 'lib/ci/reporter/spinach.rb', line 34

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



12
13
14
15
# File 'lib/ci/reporter/spinach.rb', line 12

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



17
18
19
20
# File 'lib/ci/reporter/spinach.rb', line 17

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



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

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



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

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



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

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