Class: Butternut::Formatter
- Inherits:
-
Cucumber::Formatter::Html
- Object
- Cucumber::Formatter::Html
- Butternut::Formatter
- Defined in:
- lib/butternut/formatter.rb
Instance Method Summary collapse
- #after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) ⇒ Object
- #before_feature_element(feature_element) ⇒ Object
-
#initialize(step_mother, io, options) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(step_mother, io, options) ⇒ Formatter
Returns a new instance of Formatter.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/butternut/formatter.rb', line 12 def initialize(step_mother, io, ) # find the format options format = [:formats].detect { |(name, _)| name == "Butternut::Formatter" } if !format || !format[1].is_a?(String) raise "Butternut::Formatter cannot output to STDOUT" end out = format[1] super if File.directory?(out) #@assets_dir = out #@assets_url = "." else basename = File.basename(out).sub(/\..*$/, "") @assets_dir = File.join(File.dirname(out), basename) @assets_url = basename if !File.exist?(@assets_dir) FileUtils.mkdir(@assets_dir) end end end |
Instance Method Details
#after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/butternut/formatter.rb', line 39 def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) stop_buffering :step_result return if @hide_this_step builder.li(:id => @step_id, :class => "step #{status}") do add_page_source_link(builder) builder << buffer(:step_result) end end |
#before_feature_element(feature_element) ⇒ Object
34 35 36 37 |
# File 'lib/butternut/formatter.rb', line 34 def before_feature_element(feature_element) super @feature_element = feature_element end |