Class: TestAssistant::FailureReporter
- Inherits:
-
Object
- Object
- TestAssistant::FailureReporter
- Defined in:
- lib/test_assistant/failure_reporter.rb
Overview
Factory class for generating a failure report summarising the last request and response sent in a particular test and opening it in a browser. Intended to aid in debugging and to be toggled on through the use of RSpec tags and configured using TestAssistant::Configuration#render_failed_responses
Defined Under Namespace
Classes: JsonReporter, SummaryReporter, TextReporter
Class Method Summary collapse
Class Method Details
.file_extension(content_type) ⇒ Object
118 119 120 |
# File 'lib/test_assistant/failure_reporter.rb', line 118 def self.file_extension(content_type) MIME::Types[content_type].first.extensions.first end |
.report(request, response) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/test_assistant/failure_reporter.rb', line 105 def self.report(request, response) extension = file_extension(response.content_type) case extension when 'txt' TextReporter.new(request, response) when 'json' JsonReporter.new(request, response) else SummaryReporter.new(request, response, extension) end end |