Class: CI::Reporter::Spinach

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

Instance Method Summary collapse

Constructor Details

#initializeSpinach

Returns a new instance of Spinach.



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

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

Instance Method Details

#after_feature_run(feature) ⇒ Object



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

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



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

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



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

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



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

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



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

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



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

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



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

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