Class: RCheck::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/rcheck/result.rb

Overview

Suites and assertions must implement a method called .result, which returns an instance of this class. This is in order to have a fixed interface between test results and report printers. Only the relevant fields should be filled out, as the reporter will ignore empty fields.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Result

Returns a new instance of Result.



16
17
18
19
20
21
22
23
24
# File 'lib/rcheck/result.rb', line 16

def initialize(hash)
  hash.each { |k, v| instance_variable_set "@#{k}", v }
  @info       ||= []
  @backtrace  ||= []
  @location   || raise('assertion did not provide a location')
  unless hash[:progress] == false
    ProgressPrinters.track_progress! self
  end
end

Instance Attribute Details

#backtraceObject (readonly)

Returns the value of attribute backtrace.



8
9
10
# File 'lib/rcheck/result.rb', line 8

def backtrace
  @backtrace
end

#infoObject (readonly)

Returns the value of attribute info.



8
9
10
# File 'lib/rcheck/result.rb', line 8

def info
  @info
end

#introspectionObject (readonly)

Returns the value of attribute introspection.



8
9
10
# File 'lib/rcheck/result.rb', line 8

def introspection
  @introspection
end

#locationObject (readonly)

Returns the value of attribute location.



8
9
10
# File 'lib/rcheck/result.rb', line 8

def location
  @location
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/rcheck/result.rb', line 8

def status
  @status
end

#suiteObject (readonly)

Returns the value of attribute suite.



8
9
10
# File 'lib/rcheck/result.rb', line 8

def suite
  @suite
end