Class: CucumberScreenshot::Formatter
- Inherits:
-
Cucumber::Ast::Visitor
- Object
- Cucumber::Ast::Visitor
- CucumberScreenshot::Formatter
- Defined in:
- lib/cucumber_screenshot/formatter.rb
Instance Attribute Summary collapse
-
#current_feature_segment ⇒ Object
Returns the value of attribute current_feature_segment.
-
#current_scenario_segment ⇒ Object
Returns the value of attribute current_scenario_segment.
-
#response_body_for_last_screenshot ⇒ Object
Returns the value of attribute response_body_for_last_screenshot.
-
#screenshot_directory ⇒ Object
Returns the value of attribute screenshot_directory.
-
#screenshot_index ⇒ Object
Returns the value of attribute screenshot_index.
Instance Method Summary collapse
-
#initialize(step_mother, io, options) ⇒ Formatter
constructor
Currently ignores io and options arguments.
- #visit_feature(feature) ⇒ Object
- #visit_feature_name(name) ⇒ Object
- #visit_scenario_name(keyword, name, file_colon_line, source_indent) ⇒ Object
- #visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) ⇒ Object
Constructor Details
#initialize(step_mother, io, options) ⇒ Formatter
Currently ignores io and options arguments
7 8 9 10 11 |
# File 'lib/cucumber_screenshot/formatter.rb', line 7 def initialize(step_mother, io, ) super(step_mother) @io = io @options = end |
Instance Attribute Details
#current_feature_segment ⇒ Object
Returns the value of attribute current_feature_segment.
4 5 6 |
# File 'lib/cucumber_screenshot/formatter.rb', line 4 def current_feature_segment @current_feature_segment end |
#current_scenario_segment ⇒ Object
Returns the value of attribute current_scenario_segment.
4 5 6 |
# File 'lib/cucumber_screenshot/formatter.rb', line 4 def current_scenario_segment @current_scenario_segment end |
#response_body_for_last_screenshot ⇒ Object
Returns the value of attribute response_body_for_last_screenshot.
4 5 6 |
# File 'lib/cucumber_screenshot/formatter.rb', line 4 def response_body_for_last_screenshot @response_body_for_last_screenshot end |
#screenshot_directory ⇒ Object
Returns the value of attribute screenshot_directory.
4 5 6 |
# File 'lib/cucumber_screenshot/formatter.rb', line 4 def screenshot_directory @screenshot_directory end |
#screenshot_index ⇒ Object
Returns the value of attribute screenshot_index.
4 5 6 |
# File 'lib/cucumber_screenshot/formatter.rb', line 4 def screenshot_index @screenshot_index end |
Instance Method Details
#visit_feature(feature) ⇒ Object
29 30 31 32 |
# File 'lib/cucumber_screenshot/formatter.rb', line 29 def visit_feature(feature) self.current_feature_segment = segment_for_feature(feature) super end |
#visit_feature_name(name) ⇒ Object
34 35 36 |
# File 'lib/cucumber_screenshot/formatter.rb', line 34 def visit_feature_name(name) puts(name) end |
#visit_scenario_name(keyword, name, file_colon_line, source_indent) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/cucumber_screenshot/formatter.rb', line 22 def visit_scenario_name(keyword, name, file_colon_line, source_indent) puts "Scenario #{name}" self.response_body_for_last_screenshot = nil self.screenshot_index = 0 self.current_scenario_segment = segment_for_scenario_named(name) end |
#visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/cucumber_screenshot/formatter.rb', line 13 def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) if screenshot_due? self.screenshot_index = screenshot_index.next exit unless session.screenshot(screenshot_directory_name, "screenshot-#{format('%03d', screenshot_index)}") self.response_body_for_last_screenshot = current_response_body end super end |