Class: Spinach::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/spinach/reporter.rb,
lib/spinach/reporter/stdout.rb

Overview

Spinach reporter collects information from Runner hooks and outputs the results

Direct Known Subclasses

Stdout

Defined Under Namespace

Classes: Stdout

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Reporter

Initialize a reporter with an empty error container.



10
11
12
13
14
15
16
17
# File 'lib/spinach/reporter.rb', line 10

def initialize(options = {})
  @errors = []
  @options = options
  @undefined_features = []
  @undefined_steps = []
  @failed_steps = []
  @error_steps = []
end

Instance Attribute Details

#current_featureObject

Returns the value of attribute current_feature.



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

def current_feature
  @current_feature
end

#current_scenarioObject

Returns the value of attribute current_scenario.



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

def current_scenario
  @current_scenario
end

#error_stepsObject (readonly)

Returns the value of attribute error_steps.



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

def error_steps
  @error_steps
end

#failed_stepsObject (readonly)

Returns the value of attribute failed_steps.



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

def failed_steps
  @failed_steps
end

#optionsObject (readonly)

A Hash with options for the reporter



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

def options
  @options
end

#undefined_featuresObject (readonly)

Returns the value of attribute undefined_features.



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

def undefined_features
  @undefined_features
end

#undefined_stepsObject (readonly)

Returns the value of attribute undefined_steps.



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

def undefined_steps
  @undefined_steps
end

Instance Method Details

#after_feature_run(*args) ⇒ Object



52
# File 'lib/spinach/reporter.rb', line 52

def after_feature_run(*args); end

#after_run(*args) ⇒ Object



50
# File 'lib/spinach/reporter.rb', line 50

def after_run(*args); end

#after_scenario_run(*args) ⇒ Object



55
# File 'lib/spinach/reporter.rb', line 55

def after_scenario_run(*args); end

#before_feature_run(*args) ⇒ Object



51
# File 'lib/spinach/reporter.rb', line 51

def before_feature_run(*args); end

#before_scenario_run(*args) ⇒ Object



54
# File 'lib/spinach/reporter.rb', line 54

def before_scenario_run(*args); end

#bindObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/spinach/reporter.rb', line 27

def bind
  runner.after_run method(:after_run)
  feature_runner.before_run method(:before_feature_run)
  feature_runner.after_run method(:after_feature_run)
  feature_runner.when_not_found method(:on_feature_not_found)
  scenario_runner.before_run method(:before_scenario_run)
  scenario_runner.after_run method(:after_scenario_run)
  scenario_runner.on_successful_step method(:on_successful_step)
  scenario_runner.on_undefined_step method(:on_undefined_step)
  scenario_runner.on_failed_step method(:on_failed_step)
  scenario_runner.on_error_step method(:on_error_step)
  scenario_runner.on_skipped_step method(:on_skipped_step)

  feature_runner.before_run method(:current_feature=)
  feature_runner.after_run method(:clear_current_feature)
  scenario_runner.before_run method(:current_scenario=)
  scenario_runner.after_run method(:clear_current_scenario)
end

#clear_current_feature(*args) ⇒ Object



62
63
64
# File 'lib/spinach/reporter.rb', line 62

def clear_current_feature(*args)
  self.current_feature = nil
end

#clear_current_scenario(*args) ⇒ Object



66
67
68
# File 'lib/spinach/reporter.rb', line 66

def clear_current_scenario(*args)
  self.current_scenario = nil
end

#feature_runnerObject



46
# File 'lib/spinach/reporter.rb', line 46

def feature_runner; Runner::Feature; end

#on_error_step(*args) ⇒ Object



58
# File 'lib/spinach/reporter.rb', line 58

def on_error_step(*args); end

#on_failed_step(*args) ⇒ Object



57
# File 'lib/spinach/reporter.rb', line 57

def on_failed_step(*args); end

#on_feature_not_found(*args) ⇒ Object



53
# File 'lib/spinach/reporter.rb', line 53

def on_feature_not_found(*args); end

#on_skipped_step(*args) ⇒ Object



60
# File 'lib/spinach/reporter.rb', line 60

def on_skipped_step(*args); end

#on_successful_step(*args) ⇒ Object



56
# File 'lib/spinach/reporter.rb', line 56

def on_successful_step(*args); end

#on_undefined_step(*args) ⇒ Object



59
# File 'lib/spinach/reporter.rb', line 59

def on_undefined_step(*args); end

#runnerObject



48
# File 'lib/spinach/reporter.rb', line 48

def runner; Runner; end

#scenario_runnerObject



47
# File 'lib/spinach/reporter.rb', line 47

def scenario_runner; Runner::Scenario; end