Class: Rocha::Reporter::Metadata
- Inherits:
-
Object
- Object
- Rocha::Reporter::Metadata
- Defined in:
- lib/rocha/reporter/metadata.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #described_class ⇒ Object
- #description ⇒ Object
- #exception ⇒ Object
- #execution_result ⇒ Object
- #file_path ⇒ Object (also: #location)
- #full_description ⇒ Object
-
#initialize(data) ⇒ Metadata
constructor
A new instance of Metadata.
- #line_number ⇒ Object
- #pending ⇒ Object
- #pending_message ⇒ Object
- #update(data) ⇒ Object
Constructor Details
#initialize(data) ⇒ Metadata
Returns a new instance of Metadata.
14 15 16 |
# File 'lib/rocha/reporter/metadata.rb', line 14 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
12 13 14 |
# File 'lib/rocha/reporter/metadata.rb', line 12 def data @data end |
Instance Method Details
#[](key) ⇒ Object
18 19 20 |
# File 'lib/rocha/reporter/metadata.rb', line 18 def [](key) respond_to?(key) ? send(key) : data[key] end |
#described_class ⇒ Object
63 64 65 66 |
# File 'lib/rocha/reporter/metadata.rb', line 63 def described_class STDERR.puts "described_class not implemented" if Rocha.verbose nil end |
#description ⇒ Object
72 73 74 |
# File 'lib/rocha/reporter/metadata.rb', line 72 def description data['title'] end |
#exception ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/rocha/reporter/metadata.rb', line 48 def exception return unless data['status'] == "failed" @exception ||= begin e = Reporter::SpecException.new("#{data['error']['name']}: #{data['error']['message']}") e.set_backtrace([]) e end end |
#execution_result ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/rocha/reporter/metadata.rb', line 38 def execution_result @execution_result ||= { :status => data['status'], :started_at => nil, :finished_at => nil, :run_time => data['duration'], :exception => exception } end |
#file_path ⇒ Object Also known as: location
26 27 28 29 |
# File 'lib/rocha/reporter/metadata.rb', line 26 def file_path # FIXME: This is needed to not crash in RSpec formatters data['path'] || '<script.js>' end |
#full_description ⇒ Object
76 77 78 |
# File 'lib/rocha/reporter/metadata.rb', line 76 def full_description data['fullTitle'] end |
#line_number ⇒ Object
33 34 35 36 |
# File 'lib/rocha/reporter/metadata.rb', line 33 def line_number STDERR.puts "line_number not implemented" if Rocha.verbose nil end |
#pending ⇒ Object
68 69 70 |
# File 'lib/rocha/reporter/metadata.rb', line 68 def pending data['status'] == "pending" end |
#pending_message ⇒ Object
58 59 60 61 |
# File 'lib/rocha/reporter/metadata.rb', line 58 def STDERR.puts "pending_message not implemented" if Rocha.verbose nil end |
#update(data) ⇒ Object
22 23 24 |
# File 'lib/rocha/reporter/metadata.rb', line 22 def update(data) @data.merge!(data) end |