| 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 94
94: def collected_steps(steps)
95: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 56
56: def run_ended
57: @output.puts "#@count scenarios: #@successful_scenario_count succeeded, #{@failed_scenarios.size} failed, #@pending_scenario_count pending"
58: unless @pending_steps.empty?
59: @output.puts "\nPending Steps:"
60: @pending_steps.each_with_index do |pending, i|
61: title, scenario_name, msg = pending
62: @output.puts "#{i+1}) #{title} (#{scenario_name}): #{msg}"
63: end
64: end
65: unless @failed_scenarios.empty?
66: @output.print "\nFAILURES:"
67: @failed_scenarios.each_with_index do |failure, i|
68: title, scenario_name, err = failure
69: @output.print %[
70: #{i+1}) #{title} (#{scenario_name}) FAILED
71: #{err.class}: #{err.message}
72: #{err.backtrace.join("\n")}
73: ]
74: end
75: end
76: 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 45
45: def scenario_failed(story_title, scenario_name, err)
46: @failed_scenarios << [story_title, scenario_name, err] unless @scenario_already_failed
47: @scenario_already_failed = true
48: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 50
50: def scenario_pending(story_title, scenario_name, msg)
51: @pending_steps << [story_title, scenario_name, msg]
52: @pending_scenario_count += 1 unless @scenario_already_failed
53: @scenario_already_failed = true
54: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 35
35: def scenario_started(story_title, scenario_name)
36: @scenario_already_failed = false
37: @output.print "\n\n Scenario: #{scenario_name}"
38: @scenario_ok = true
39: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 41
41: def scenario_succeeded(story_title, scenario_name)
42: @successful_scenario_count += 1
43: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 88
88: def step_failed(type, description, *args)
89: found_step(type, description, true, *args)
90: @output.print red(@scenario_ok ? " (FAILED)" : " (SKIPPED)")
91: @scenario_ok = false
92: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 82
82: def step_pending(type, description, *args)
83: found_step(type, description, false, *args)
84: @output.print " (PENDING)"
85: @scenario_ok = false
86: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 78
78: def step_succeeded(type, description, *args)
79: found_step(type, description, false, *args)
80: end
# File lib/spec/runner/formatter/story/plain_text_formatter.rb, line 30
30: def story_ended(title, narrative)
31: @output.puts
32: @output.puts
33: end