Class: Example
- Inherits:
-
Object
- Object
- Example
- Defined in:
- lib/example.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#full_description ⇒ Object
readonly
Returns the value of attribute full_description.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#run_time ⇒ Object
readonly
Returns the value of attribute run_time.
-
#screenshot ⇒ Object
readonly
Returns the value of attribute screenshot.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #has_exception? ⇒ Boolean
- #has_spec? ⇒ Boolean
-
#initialize(example) ⇒ Example
constructor
A new instance of Example.
- #klass(prefix = 'label-') ⇒ Object
- #set_spec(spec) ⇒ Object
Constructor Details
#initialize(example) ⇒ Example
Returns a new instance of Example.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/example.rb', line 9 def initialize(example) @description = example.description @full_description = example.full_description @execution_result = example.execution_result @run_time = (@execution_result.run_time).round(5) @duration = @execution_result.run_time.to_s(:rounded, precision: 5) @status = @execution_result.status.to_s = example. @file_path = [:file_path] @exception = Oopsy.new(example.exception, @file_path) @screenshot = screenshot_path @spec = nil end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/example.rb', line 6 def description @description end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
6 7 8 |
# File 'lib/example.rb', line 6 def duration @duration end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
6 7 8 |
# File 'lib/example.rb', line 6 def exception @exception end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
6 7 8 |
# File 'lib/example.rb', line 6 def file_path @file_path end |
#full_description ⇒ Object (readonly)
Returns the value of attribute full_description.
6 7 8 |
# File 'lib/example.rb', line 6 def full_description @full_description end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/example.rb', line 6 def end |
#run_time ⇒ Object (readonly)
Returns the value of attribute run_time.
6 7 8 |
# File 'lib/example.rb', line 6 def run_time @run_time end |
#screenshot ⇒ Object (readonly)
Returns the value of attribute screenshot.
6 7 8 |
# File 'lib/example.rb', line 6 def screenshot @screenshot end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
6 7 8 |
# File 'lib/example.rb', line 6 def spec @spec end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/example.rb', line 6 def status @status end |
Instance Method Details
#has_exception? ⇒ Boolean
23 24 25 |
# File 'lib/example.rb', line 23 def has_exception? !@exception.klass.nil? end |
#has_spec? ⇒ Boolean
27 28 29 |
# File 'lib/example.rb', line 27 def has_spec? !@spec.nil? end |
#klass(prefix = 'label-') ⇒ Object
35 36 37 38 |
# File 'lib/example.rb', line 35 def klass(prefix = 'label-') class_map = { passed: "#{prefix}success", failed: "#{prefix}danger", pending: "#{prefix}warning" } class_map[@status.to_sym] end |
#set_spec(spec) ⇒ Object
31 32 33 |
# File 'lib/example.rb', line 31 def set_spec(spec) @spec = spec end |