Class: Whitestone::Test
Overview
A Test object is what results when the following code is executed:
D "civil" do
Eq @d.year, 1972
Eq @d.month, 5
Eq @d.day, 13
end
Test objects gather in a tree structure, useful for reporting.
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#description ⇒ Object
Returns the value of attribute description.
-
#error ⇒ Object
Returns the value of attribute error.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#result ⇒ Object
Returns the value of attribute result.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #error? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(description, block, sandbox) ⇒ Test
constructor
A new instance of Test.
- #passed? ⇒ Boolean
Constructor Details
#initialize(description, block, sandbox) ⇒ Test
Returns a new instance of Test.
54 55 56 57 58 59 60 |
# File 'lib/whitestone.rb', line 54 def initialize(description, block, sandbox) @description, @block, @sandbox = description, block, sandbox @result = :blank # A 'blank' result until an assertion is run. @error = nil # The exception object, if any. @parent = nil # The test object in whose scope this test is defined. @children = [] # The children of this test. end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
49 50 51 |
# File 'lib/whitestone.rb', line 49 def block @block end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
53 54 55 |
# File 'lib/whitestone.rb', line 53 def children @children end |
#description ⇒ Object
Returns the value of attribute description.
49 50 51 |
# File 'lib/whitestone.rb', line 49 def description @description end |
#error ⇒ Object
Returns the value of attribute error.
51 52 53 |
# File 'lib/whitestone.rb', line 51 def error @error end |
#parent ⇒ Object
Returns the value of attribute parent.
52 53 54 |
# File 'lib/whitestone.rb', line 52 def parent @parent end |
#result ⇒ Object
Returns the value of attribute result.
50 51 52 |
# File 'lib/whitestone.rb', line 50 def result @result end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
49 50 51 |
# File 'lib/whitestone.rb', line 49 def sandbox @sandbox end |
Instance Method Details
#blank? ⇒ Boolean
70 |
# File 'lib/whitestone.rb', line 70 def blank?; @result == :blank; end |
#error? ⇒ Boolean
69 |
# File 'lib/whitestone.rb', line 69 def error?; @result == :error; end |
#failed? ⇒ Boolean
68 |
# File 'lib/whitestone.rb', line 68 def failed?; @result == :fail; end |
#passed? ⇒ Boolean
67 |
# File 'lib/whitestone.rb', line 67 def passed?; @result == :pass; end |