Class: Spectre::RunInfo
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#error ⇒ Object
Returns the value of attribute error.
-
#expectations ⇒ Object
readonly
Returns the value of attribute expectations.
-
#failure ⇒ Object
Returns the value of attribute failure.
-
#finished ⇒ Object
Returns the value of attribute finished.
-
#log ⇒ Object
readonly
Returns the value of attribute log.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#skipped ⇒ Object
Returns the value of attribute skipped.
-
#spec ⇒ Object
Returns the value of attribute spec.
-
#started ⇒ Object
Returns the value of attribute started.
Instance Method Summary collapse
- #duration ⇒ Object
- #error? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(spec, data = nil) ⇒ RunInfo
constructor
A new instance of RunInfo.
- #skipped? ⇒ Boolean
- #status ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(spec, data = nil) ⇒ RunInfo
Returns a new instance of RunInfo.
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/spectre.rb', line 138 def initialize spec, data=nil @spec = spec @data = data @started = nil @finished = nil @error = nil @failure = nil @skipped = false @log = [] @expectations = [] @properties = {} end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
135 136 137 |
# File 'lib/spectre.rb', line 135 def data @data end |
#error ⇒ Object
Returns the value of attribute error.
135 136 137 |
# File 'lib/spectre.rb', line 135 def error @error end |
#expectations ⇒ Object (readonly)
Returns the value of attribute expectations.
136 137 138 |
# File 'lib/spectre.rb', line 136 def expectations @expectations end |
#failure ⇒ Object
Returns the value of attribute failure.
135 136 137 |
# File 'lib/spectre.rb', line 135 def failure @failure end |
#finished ⇒ Object
Returns the value of attribute finished.
135 136 137 |
# File 'lib/spectre.rb', line 135 def finished @finished end |
#log ⇒ Object (readonly)
Returns the value of attribute log.
136 137 138 |
# File 'lib/spectre.rb', line 136 def log @log end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
136 137 138 |
# File 'lib/spectre.rb', line 136 def properties @properties end |
#skipped ⇒ Object
Returns the value of attribute skipped.
135 136 137 |
# File 'lib/spectre.rb', line 135 def skipped @skipped end |
#spec ⇒ Object
Returns the value of attribute spec.
135 136 137 |
# File 'lib/spectre.rb', line 135 def spec @spec end |
#started ⇒ Object
Returns the value of attribute started.
135 136 137 |
# File 'lib/spectre.rb', line 135 def started @started end |
Instance Method Details
#duration ⇒ Object
151 152 153 |
# File 'lib/spectre.rb', line 151 def duration @finished - @started end |
#error? ⇒ Boolean
163 164 165 |
# File 'lib/spectre.rb', line 163 def error? @error != nil end |
#failed? ⇒ Boolean
159 160 161 |
# File 'lib/spectre.rb', line 159 def failed? @failure != nil end |
#skipped? ⇒ Boolean
155 156 157 |
# File 'lib/spectre.rb', line 155 def skipped? @skipped end |
#status ⇒ Object
167 168 169 170 171 172 173 |
# File 'lib/spectre.rb', line 167 def status return :error if error? return :failed if failed? return :skipped if skipped? return :success end |
#to_h ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/spectre.rb', line 175 def to_h date_format = '%FT%T.%L%:z' { spec: @spec.name, data: @data, started: @started.strftime(date_format), finished: @finished.strftime(date_format), error: @error, failure: @failure, skipped: @skipped, log: @log.map { |, , level, name| [.strftime(date_format), , level, name] }, expectations: @expectations, properties: @properties, } end |