Class | Spec::Runner::Formatter::Story::PlainTextFormatter
In: | lib/spec/runner/formatter/story/plain_text_formatter.rb
Parent: | BaseTextFormatter

### Methods

collected_steps new run_ended run_started scenario_failed scenario_pending scenario_started scenario_succeeded step_failed step_pending step_succeeded step_upcoming story_ended story_started

### Public Class methods

new(options, where)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 8
     8:           def initialize(options, where)
     9:             super
    10:             @successful_scenario_count = 0
    11:             @pending_scenario_count = 0
    12:             @failed_scenarios = []
    13:             @pending_steps = []
    14:             @previous_type = nil
    15:           end

### Public Instance methods

collected_steps(steps)

[Source]

         # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 107
    107:           def collected_steps(steps)
    108:           end

run_ended()

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 60
    60:           def run_ended
    61:             @output.puts "#@count scenarios: #@successful_scenario_count succeeded, #{@failed_scenarios.size} failed, #@pending_scenario_count pending"
    62:             unless @pending_steps.empty?
    63:               @output.puts "\nPending Steps:"
    64:               @pending_steps.each_with_index do |pending, i|
    65:                 story_name, scenario_name, msg = pending
    66:                 @output.puts "#{i+1}) #{story_name} (#{scenario_name}): #{msg}"
    67:               end
    68:             end
    69:             unless @failed_scenarios.empty?
    70:               @output.print "\nFAILURES:"
    71:               @failed_scenarios.each_with_index do |failure, i|
    72:                 title, scenario_name, err = failure
    73:                 @output.print %[
    74:     #{i+1}) #{title} (#{scenario_name}) FAILED
    75:     #{err.class}: #{err.message}
    76:     #{err.backtrace.join("\n")}
    77: ]
    78:               end
    79:             end
    80:           end

run_started(count)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 17
    17:           def run_started(count)
    18:             @count = count
    19:             @output.puts "Running #@count scenarios\n\n"
    20:           end

scenario_failed(story_title, scenario_name, err)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 48
    48:           def scenario_failed(story_title, scenario_name, err)
    49:             @options.backtrace_tweaker.tweak_backtrace(err)
    50:             @failed_scenarios << [story_title, scenario_name, err] unless @scenario_already_failed
    51:             @scenario_already_failed = true
    52:           end

scenario_pending(story_title, scenario_name, msg)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 54
    54:           def scenario_pending(story_title, scenario_name, msg)
    55:             @pending_scenario_count += 1 unless @scenario_already_failed
    56:             @scenario_pending = true
    57:             @scenario_already_failed = true
    58:           end

scenario_started(story_title, scenario_name)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 36
    36:           def scenario_started(story_title, scenario_name)
    37:             @current_scenario_name = scenario_name
    38:             @scenario_already_failed = false
    39:             @output.print "\n\n  Scenario: #{scenario_name}"
    40:             @scenario_ok = true
    41:             @scenario_pending = false
    42:           end

scenario_succeeded(story_title, scenario_name)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 44
    44:           def scenario_succeeded(story_title, scenario_name)
    45:             @successful_scenario_count += 1
    46:           end

step_failed(type, description, *args)

[Source]

         # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 97
     97:           def step_failed(type, description, *args)
     98:             found_step(type, description, true, @scenario_pending, *args)
     99:             if @scenario_pending
    100:               @output.print yellow(" (SKIPPED)")
    101:             else
    102:               @output.print red(@scenario_ok ? " (FAILED)" : " (SKIPPED)")
    103:             end
    104:             @scenario_ok = false
    105:           end

step_pending(type, description, *args)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 89
    89:           def step_pending(type, description, *args)
    90:             found_step(type, description, false, true, *args)
    91:             @pending_steps << [@current_story_title, @current_scenario_name, description]
    92:             @output.print yellow(" (PENDING)")
    93:             @scenario_pending = true
    94:             @scenario_ok = false
    95:           end

step_succeeded(type, description, *args)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 85
    85:           def step_succeeded(type, description, *args)
    86:             found_step(type, description, false, false, *args)
    87:           end

step_upcoming(type, description, *args)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 82
    82:           def step_upcoming(type, description, *args)
    83:           end

story_ended(title, narrative)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 31
    31:           def story_ended(title, narrative)
    32:             @output.puts
    33:             @output.puts
    34:           end

story_started(title, narrative)

[Source]

        # File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 22
    22:           def story_started(title, narrative)
    23:             @current_story_title = title
    24:             @output.puts "Story: #{title}\n\n"
    25:             narrative.each_line do |line|
    26:               @output.print "  "
    27:               @output.print line
    28:             end
    29:           end

[Validate]