Class: DevCreek::TestResult
- Inherits:
-
Object
- Object
- DevCreek::TestResult
- Defined in:
- lib/devcreek_testresult.rb
Constant Summary collapse
- OK =
"OK"
- FAILURE =
"FAILURE"
- ERROR =
"ERROR"
Instance Attribute Summary collapse
-
#finish ⇒ Object
readonly
Returns the value of attribute finish.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#test_class ⇒ Object
readonly
Returns the value of attribute test_class.
-
#test_name ⇒ Object
readonly
Returns the value of attribute test_name.
Instance Method Summary collapse
- #elapsed_time ⇒ Object
- #has_a_failure ⇒ Object
- #has_an_error ⇒ Object
- #has_finished ⇒ Object
-
#initialize(test_name, test_class, status = OK, start = Time.now) ⇒ TestResult
constructor
A new instance of TestResult.
Constructor Details
#initialize(test_name, test_class, status = OK, start = Time.now) ⇒ TestResult
Returns a new instance of TestResult.
15 16 17 |
# File 'lib/devcreek_testresult.rb', line 15 def initialize(test_name, test_class, status=OK, start=Time.now) @test_name, @test_class, @status, @start = test_name, test_class, status, start end |
Instance Attribute Details
#finish ⇒ Object (readonly)
Returns the value of attribute finish.
13 14 15 |
# File 'lib/devcreek_testresult.rb', line 13 def finish @finish end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
13 14 15 |
# File 'lib/devcreek_testresult.rb', line 13 def start @start end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
13 14 15 |
# File 'lib/devcreek_testresult.rb', line 13 def status @status end |
#test_class ⇒ Object (readonly)
Returns the value of attribute test_class.
13 14 15 |
# File 'lib/devcreek_testresult.rb', line 13 def test_class @test_class end |
#test_name ⇒ Object (readonly)
Returns the value of attribute test_name.
13 14 15 |
# File 'lib/devcreek_testresult.rb', line 13 def test_name @test_name end |
Instance Method Details
#elapsed_time ⇒ Object
24 25 26 |
# File 'lib/devcreek_testresult.rb', line 24 def elapsed_time return finish - start unless finish.nil? or start.nil? end |
#has_a_failure ⇒ Object
28 29 30 |
# File 'lib/devcreek_testresult.rb', line 28 def has_a_failure @status = FAILURE end |
#has_an_error ⇒ Object
32 33 34 |
# File 'lib/devcreek_testresult.rb', line 32 def has_an_error @status = ERROR end |
#has_finished ⇒ Object
19 20 21 22 |
# File 'lib/devcreek_testresult.rb', line 19 def has_finished raise ArgumentError, "The finish time cannot be set twice" unless @finish.nil? @finish = Time.now end |