Class | Spec::Runner::Formatter::Story::PlainTextFormatter |
In: |
vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb
|
Parent: | Spec::Runner::Formatter::BaseTextFormatter |
# File vendor/plugins/rspec/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: 13: @pre_story_pending_count = 0 14: @pre_story_successful_count = 0 15: 16: @failed_scenarios = [] 17: @pending_steps = [] 18: @previous_type = nil 19: 20: @scenario_body_text = "" 21: @story_body_text = "" 22: 23: @scenario_head_text = "" 24: @story_head_text = "" 25: 26: @scenario_failed = false 27: @story_failed = false 28: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 153 153: def collected_steps(steps) 154: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 106 106: def run_ended 107: @output.puts "#@count scenarios: #@successful_scenario_count succeeded, #{@failed_scenarios.size} failed, #@pending_scenario_count pending" 108: unless @pending_steps.empty? 109: @output.puts "\nPending Steps:" 110: @pending_steps.each_with_index do |pending, i| 111: story_name, scenario_name, msg = pending 112: @output.puts "#{i+1}) #{story_name} (#{scenario_name}): #{msg}" 113: end 114: end 115: unless @failed_scenarios.empty? 116: @output.print "\nFAILURES:" 117: @failed_scenarios.each_with_index do |failure, i| 118: title, scenario_name, err = failure 119: @output.print %[ 120: #{i+1}) #{title} (#{scenario_name}) FAILED 121: #{err.class}: #{err.message} 122: #{err.backtrace.join("\n")} 123: ] 124: end 125: end 126: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 30 30: def run_started(count) 31: @count = count 32: @output.puts "Running #@count scenarios\n\n" 33: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 95 95: def scenario_ended 96: if @scenario_failed 97: @story_body_text += red(@scenario_head_text) 98: elsif @scenario_pending 99: @story_body_text += yellow(@scenario_head_text) 100: else 101: @story_body_text += green(@scenario_head_text) 102: end 103: @story_body_text += @scenario_body_text 104: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 79 79: def scenario_failed(story_title, scenario_name, err) 80: @options.backtrace_tweaker.tweak_backtrace(err) 81: @failed_scenarios << [story_title, scenario_name, err] unless @scenario_already_failed 82: @scenario_already_failed = true 83: @story_failed = true 84: @scenario_failed = true 85: scenario_ended 86: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 88 88: def scenario_pending(story_title, scenario_name, msg) 89: @pending_scenario_count += 1 unless @scenario_already_failed 90: @scenario_pending = true 91: @scenario_already_failed = true 92: scenario_ended 93: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 64 64: def scenario_started(story_title, scenario_name) 65: @current_scenario_name = scenario_name 66: @scenario_already_failed = false 67: @scenario_head_text = "\n\n Scenario: #{scenario_name}" 68: @scenario_body_text = "" 69: @scenario_ok = true 70: @scenario_pending = false 71: @scenario_failed = false 72: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 74 74: def scenario_succeeded(story_title, scenario_name) 75: @successful_scenario_count += 1 76: scenario_ended 77: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 143 143: def step_failed(type, description, *args) 144: found_step(type, description, true, @scenario_pending, *args) 145: if @scenario_pending 146: @scenario_body_text += yellow(" (SKIPPED)") 147: else 148: @scenario_body_text += red(@scenario_ok ? " (FAILED)" : " (SKIPPED)") 149: end 150: @scenario_ok = false 151: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 135 135: def step_pending(type, description, *args) 136: found_step(type, description, false, true, *args) 137: @pending_steps << [@current_story_title, @current_scenario_name, description] 138: @scenario_body_text += yellow(" (PENDING)") 139: @scenario_pending = true 140: @scenario_ok = false 141: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 131 131: def step_succeeded(type, description, *args) 132: found_step(type, description, false, false, *args) 133: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 128 128: def step_upcoming(type, description, *args) 129: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 50 50: def story_ended(title, narrative) 51: if @story_failed 52: @output.print red(@story_head_text) 53: elsif @pre_story_successful_count == @successful_scenario_count && 54: @pending_scenario_count >= @pre_story_pending_count 55: @output.print yellow(@story_head_text) 56: else 57: @output.print green(@story_head_text) 58: end 59: @output.print @story_body_text 60: @output.puts 61: @output.puts 62: end
# File vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb, line 35 35: def story_started(title, narrative) 36: @pre_story_pending_count = @pending_scenario_count 37: @pre_story_successful_count = @successful_scenario_count 38: 39: @current_story_title = title 40: @story_failed = false 41: @story_body_text = "" 42: @story_head_text = "Story: #{title}\n\n" 43: 44: narrative.each_line do |line| 45: @story_head_text += " " 46: @story_head_text += line 47: end 48: end