Object
# File lib/gherkin/formatter/pretty_formatter.rb, line 138 def arg_format(key) format("#{key}_arg") end
# File lib/gherkin/formatter/pretty_formatter.rb, line 37 def background(background) replay @statement = background end
# File lib/gherkin/formatter/pretty_formatter.rb, line 155 def eof replay # NO-OP end
# File lib/gherkin/formatter/pretty_formatter.rb, line 76 def examples(examples) replay @io.puts print_comments(examples.comments, ' ') print_tags(examples.tags, ' ') @io.puts " #{examples.keyword}: #{examples.name}" print_description(examples.description, ' ') table(examples.rows) end
# File lib/gherkin/formatter/pretty_formatter.rb, line 30 def feature(feature) print_comments(feature.comments, '') print_tags(feature.tags, '') @io.puts "#{feature.keyword}: #{feature.name}" print_description(feature.description, ' ', false) end
# File lib/gherkin/formatter/pretty_formatter.rb, line 142 def format(key) if @formats.nil? if @monochrome @formats = Hash.new(MonochromeFormat.new) else @formats = Hash.new do |formats, status| formats[status] = ColorFormat.new(status) end end end @formats[key] end
# File lib/gherkin/formatter/pretty_formatter.rb, line 90 def match(match) @match = match print_statement print_step('executing', @match.arguments, @match.location, false) end
# File lib/gherkin/formatter/pretty_formatter.rb, line 57 def print_statement return if @statement.nil? calculate_location_indentations @io.puts print_comments(@statement.comments, ' ') print_tags(@statement.tags, ' ') if @statement.respond_to?(:tags) # Background doesn't @io.write " #{@statement.keyword}: #{@statement.name}" location = @executing ? "#{@uri}:#{@statement.line}" : nil @io.puts indented_location(location, true) print_description(@statement.description, ' ') @statement = nil end
# File lib/gherkin/formatter/pretty_formatter.rb, line 101 def print_step(status, arguments, location, proceed) step = proceed ? @steps.shift : @steps[0] text_format = format(status) arg_format = arg_format(status) print_comments(step.comments, ' ') @io.write(' ') @io.write(text_format.text(step.keyword)) @step_printer.write_step(@io, text_format, arg_format, step.name, arguments) @io.puts(indented_location(location, proceed)) case step.multiline_arg when Model::DocString doc_string(step.multiline_arg) when Array table(step.multiline_arg) end end
# File lib/gherkin/formatter/pretty_formatter.rb, line 70 def print_steps while(@steps.any?) print_step('skipped', [], nil, true) end end
# File lib/gherkin/formatter/pretty_formatter.rb, line 52 def replay print_statement print_steps end
# File lib/gherkin/formatter/pretty_formatter.rb, line 96 def result(result) @io.write(up(1)) print_step(result.status, @match.arguments, @match.location, true) end
# File lib/gherkin/formatter/pretty_formatter.rb, line 42 def scenario(scenario) replay @statement = scenario end
# File lib/gherkin/formatter/pretty_formatter.rb, line 47 def scenario_outline(scenario_outline) replay @statement = scenario_outline end
# File lib/gherkin/formatter/pretty_formatter.rb, line 86 def step(step) @steps << step end
# File lib/gherkin/formatter/pretty_formatter.rb, line 160 def table(rows) cell_lengths = rows.map do |row| row.cells.map do |cell| escape_cell(cell).unpack("U*").length end end max_lengths = cell_lengths.transpose.map { |col_lengths| col_lengths.max }.flatten rows.each_with_index do |row, i| row.comments.each do |comment| @io.puts " #{comment.value}" end j = -1 @io.puts ' | ' + row.cells.zip(max_lengths).map { |cell, max_length| j += 1 color(cell, nil, j) + ' ' * (max_length - cell_lengths[i][j]) }.join(' | ') + ' |' end end
Generated with the Darkfish Rdoc Generator 2.