Class: TestAssistant::FailureReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/test_assistant/failure_reporter.rb

Defined Under Namespace

Classes: JsonReporter, SummaryReporter, TextReporter

Class Method Summary collapse

Class Method Details

.file_extension(content_type) ⇒ Object



90
91
92
# File 'lib/test_assistant/failure_reporter.rb', line 90

def self.file_extension(content_type)
  MIME::Types[content_type].first.extensions.first
end

.report(request, response) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/test_assistant/failure_reporter.rb', line 77

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