| Class | Spec::Runner::Formatter::Story::PlainTextFormatter |
| In: |
lib/spec/runner/formatter/story/plain_text_formatter.rb
|
| Parent: | BaseTextFormatter |
# 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
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 100
100: def collected_steps(steps)
101: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 58
58: def run_ended
59: @output.puts "#@count scenarios: #@successful_scenario_count succeeded, #{@failed_scenarios.size} failed, #@pending_scenario_count pending"
60: unless @pending_steps.empty?
61: @output.puts "\nPending Steps:"
62: @pending_steps.each_with_index do |pending, i|
63: story_name, scenario_name, msg = pending
64: @output.puts "#{i+1}) #{story_name} (#{scenario_name}): #{msg}"
65: end
66: end
67: unless @failed_scenarios.empty?
68: @output.print "\nFAILURES:"
69: @failed_scenarios.each_with_index do |failure, i|
70: title, scenario_name, err = failure
71: @output.print %[
72: #{i+1}) #{title} (#{scenario_name}) FAILED
73: #{err.class}: #{err.message}
74: #{err.backtrace.join("\n")}
75: ]
76: end
77: end
78: end
# 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
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 47
47: def scenario_failed(story_title, scenario_name, err)
48: @options.backtrace_tweaker.tweak_backtrace(err)
49: @failed_scenarios << [story_title, scenario_name, err] unless @scenario_already_failed
50: @scenario_already_failed = true
51: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 53
53: def scenario_pending(story_title, scenario_name, msg)
54: @pending_scenario_count += 1 unless @scenario_already_failed
55: @scenario_already_failed = true
56: end
# 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: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 43
43: def scenario_succeeded(story_title, scenario_name)
44: @successful_scenario_count += 1
45: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 94
94: def step_failed(type, description, *args)
95: found_step(type, description, true, *args)
96: @output.print red(@scenario_ok ? " (FAILED)" : " (SKIPPED)")
97: @scenario_ok = false
98: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 87
87: def step_pending(type, description, *args)
88: found_step(type, description, false, *args)
89: @pending_steps << [@current_story_title, @current_scenario_name, description]
90: @output.print " (PENDING)"
91: @scenario_ok = false
92: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 83
83: def step_succeeded(type, description, *args)
84: found_step(type, description, false, *args)
85: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 80
80: def step_upcoming(type, description, *args)
81: end
# 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