Class: Spinach::Reporter
- Inherits:
-
Object
- Object
- Spinach::Reporter
- Defined in:
- lib/spinach/reporter.rb,
lib/spinach/reporter/stdout.rb,
lib/spinach/reporter/stdout/error_reporting.rb
Overview
Spinach reporter collects information from Runner hooks and outputs the results
Direct Known Subclasses
Defined Under Namespace
Classes: Stdout
Instance Attribute Summary collapse
-
#current_feature ⇒ Object
readonly
A Hash with options for the reporter.
-
#current_scenario ⇒ Object
readonly
A Hash with options for the reporter.
-
#error_steps ⇒ Object
readonly
Returns the value of attribute error_steps.
-
#failed_steps ⇒ Object
readonly
Returns the value of attribute failed_steps.
-
#options ⇒ Object
readonly
A Hash with options for the reporter.
-
#pending_steps ⇒ Object
readonly
Returns the value of attribute pending_steps.
-
#successful_steps ⇒ Object
readonly
Returns the value of attribute successful_steps.
-
#undefined_features ⇒ Object
readonly
Returns the value of attribute undefined_features.
-
#undefined_steps ⇒ Object
readonly
Returns the value of attribute undefined_steps.
Instance Method Summary collapse
- #after_feature_run(*args) ⇒ Object
- #after_run(*args) ⇒ Object
- #after_scenario_run(*args) ⇒ Object
- #around_scenario_run(*args) ⇒ Object
- #before_feature_run(*args) ⇒ Object
- #before_scenario_run(*args) ⇒ Object
-
#bind ⇒ Object
Hooks the reporter to the runner endpoints.
-
#clear_current_feature(*args) ⇒ Object
Clears this current feature.
-
#clear_current_scenario(*args) ⇒ Object
Clears this current scenario.
-
#initialize(options = {}) ⇒ Reporter
constructor
Initialize a reporter with an empty error container.
- #on_error_step(*args) ⇒ Object
- #on_failed_step(*args) ⇒ Object
- #on_feature_not_found(*args) ⇒ Object
- #on_pending_step(*args) ⇒ Object
- #on_skipped_step(*args) ⇒ Object
- #on_successful_step(*args) ⇒ Object
- #on_undefined_step(*args) ⇒ Object
-
#set_current_feature(feature) ⇒ Object
Stores the current feature.
-
#set_current_scenario(scenario) ⇒ Object
Stores the current scenario.
Constructor Details
#initialize(options = {}) ⇒ Reporter
Initialize a reporter with an empty error container.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/spinach/reporter.rb', line 10 def initialize( = {}) @errors = [] @options = @undefined_features = [] @successful_steps = [] @undefined_steps = [] @failed_steps = [] @error_steps = [] @pending_steps = [] end |
Instance Attribute Details
#current_feature ⇒ Object (readonly)
A Hash with options for the reporter
23 24 25 |
# File 'lib/spinach/reporter.rb', line 23 def current_feature @current_feature end |
#current_scenario ⇒ Object (readonly)
A Hash with options for the reporter
23 24 25 |
# File 'lib/spinach/reporter.rb', line 23 def current_scenario @current_scenario end |
#error_steps ⇒ Object (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_steps ⇒ Object (readonly)
Returns the value of attribute failed_steps.
25 26 27 |
# File 'lib/spinach/reporter.rb', line 25 def failed_steps @failed_steps end |
#options ⇒ Object (readonly)
A Hash with options for the reporter
23 24 25 |
# File 'lib/spinach/reporter.rb', line 23 def @options end |
#pending_steps ⇒ Object (readonly)
Returns the value of attribute pending_steps.
25 26 27 |
# File 'lib/spinach/reporter.rb', line 25 def pending_steps @pending_steps end |
#successful_steps ⇒ Object (readonly)
Returns the value of attribute successful_steps.
25 26 27 |
# File 'lib/spinach/reporter.rb', line 25 def successful_steps @successful_steps end |
#undefined_features ⇒ Object (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_steps ⇒ Object (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
53 |
# File 'lib/spinach/reporter.rb', line 53 def after_feature_run(*args); end |
#after_run(*args) ⇒ Object
51 |
# File 'lib/spinach/reporter.rb', line 51 def after_run(*args); end |
#after_scenario_run(*args) ⇒ Object
59 |
# File 'lib/spinach/reporter.rb', line 59 def after_scenario_run(*args); end |
#around_scenario_run(*args) ⇒ Object
56 57 58 |
# File 'lib/spinach/reporter.rb', line 56 def around_scenario_run(*args) yield end |
#before_feature_run(*args) ⇒ Object
52 |
# File 'lib/spinach/reporter.rb', line 52 def before_feature_run(*args); end |
#before_scenario_run(*args) ⇒ Object
55 |
# File 'lib/spinach/reporter.rb', line 55 def before_scenario_run(*args); end |
#bind ⇒ Object
Hooks the reporter to the runner endpoints
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/spinach/reporter.rb', line 28 def bind Spinach.hooks.tap do |hooks| hooks.after_run { |*args| after_run(*args) } hooks.before_feature { |*args| before_feature_run(*args) } hooks.after_feature { |*args| after_feature_run(*args) } hooks.on_undefined_feature { |*args| on_feature_not_found(*args) } hooks.before_scenario { |*args| before_scenario_run(*args) } hooks.around_scenario { |*args, &block| around_scenario_run(*args, &block) } hooks.after_scenario { |*args| after_scenario_run(*args) } hooks.on_successful_step { |*args| on_successful_step(*args) } hooks.on_undefined_step { |*args| on_undefined_step(*args) } hooks.on_pending_step { |*args| on_pending_step(*args) } hooks.on_failed_step { |*args| on_failed_step(*args) } hooks.on_error_step { |*args| on_error_step(*args) } hooks.on_skipped_step { |*args| on_skipped_step(*args) } hooks.before_feature { |*args| set_current_feature(*args) } hooks.after_feature { |*args| clear_current_feature(*args) } hooks.before_scenario { |*args| set_current_scenario(args.first) } hooks.after_scenario { |*args| clear_current_scenario(args.first) } end end |
#clear_current_feature(*args) ⇒ Object
Clears this current feature
76 77 78 |
# File 'lib/spinach/reporter.rb', line 76 def clear_current_feature(*args) @current_feature = nil end |
#clear_current_scenario(*args) ⇒ Object
Clears this current scenario
89 90 91 |
# File 'lib/spinach/reporter.rb', line 89 def clear_current_scenario(*args) @current_scenario = nil end |
#on_error_step(*args) ⇒ Object
62 |
# File 'lib/spinach/reporter.rb', line 62 def on_error_step(*args); end |
#on_failed_step(*args) ⇒ Object
61 |
# File 'lib/spinach/reporter.rb', line 61 def on_failed_step(*args); end |
#on_feature_not_found(*args) ⇒ Object
54 |
# File 'lib/spinach/reporter.rb', line 54 def on_feature_not_found(*args); end |
#on_pending_step(*args) ⇒ Object
64 |
# File 'lib/spinach/reporter.rb', line 64 def on_pending_step(*args); end |
#on_skipped_step(*args) ⇒ Object
65 |
# File 'lib/spinach/reporter.rb', line 65 def on_skipped_step(*args); end |
#on_successful_step(*args) ⇒ Object
60 |
# File 'lib/spinach/reporter.rb', line 60 def on_successful_step(*args); end |
#on_undefined_step(*args) ⇒ Object
63 |
# File 'lib/spinach/reporter.rb', line 63 def on_undefined_step(*args); end |
#set_current_feature(feature) ⇒ Object
Stores the current feature
71 72 73 |
# File 'lib/spinach/reporter.rb', line 71 def set_current_feature(feature) @current_feature = feature end |
#set_current_scenario(scenario) ⇒ Object
Stores the current scenario
84 85 86 |
# File 'lib/spinach/reporter.rb', line 84 def set_current_scenario(scenario) @current_scenario = scenario end |