Class: RSpec::Core::Formatters::GorgonRspecFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- RSpec::Core::Formatters::GorgonRspecFormatter
- Defined in:
- lib/gorgon/gorgon_rspec_formatter.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(output) ⇒ GorgonRspecFormatter
constructor
A new instance of GorgonRspecFormatter.
- #message(message) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(output) ⇒ GorgonRspecFormatter
Returns a new instance of GorgonRspecFormatter.
10 11 12 13 |
# File 'lib/gorgon/gorgon_rspec_formatter.rb', line 10 def initialize(output) super @failures = [] end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
8 9 10 |
# File 'lib/gorgon/gorgon_rspec_formatter.rb', line 8 def output @output end |
Instance Method Details
#close ⇒ Object
42 43 44 45 |
# File 'lib/gorgon/gorgon_rspec_formatter.rb', line 42 def close output.write @failures.to_json output.close if IO === output && output != $stdout end |
#message(message) ⇒ Object
15 16 17 |
# File 'lib/gorgon/gorgon_rspec_formatter.rb', line 15 def () @failures += unless @failures.empty? end |
#stop ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gorgon/gorgon_rspec_formatter.rb', line 19 def stop super failures = examples.select { |e| e.execution_result[:status] == "failed" } @failures += failures.map do |failure| { :test_name => "#{failure.full_description}: " \ "line #{failure.[:line_number]}", :description => failure.description, :full_description => failure.full_description, :status => failure.execution_result[:status], :file_path => failure.[:file_path], :line_number => failure.[:line_number], }.tap do |hash| if e=failure.exception hash[:class] = e.class.name hash[:message] = e. hash[:location] = e.backtrace end end end end |