Class: Testy::Test::Result
- Inherits:
-
Object
- Object
- Testy::Test::Result
- Defined in:
- lib/testy.rb
Instance Attribute Summary collapse
-
#actual ⇒ Object
Returns the value of attribute actual.
-
#expect ⇒ Object
Returns the value of attribute expect.
Instance Method Summary collapse
- #check(name, *args) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ Result
constructor
A new instance of Result.
- #ok? ⇒ Boolean
Constructor Details
#initialize ⇒ Result
Returns a new instance of Result.
24 25 26 27 |
# File 'lib/testy.rb', line 24 def initialize @expect = OrderedHash.new @actual = OrderedHash.new end |
Instance Attribute Details
#actual ⇒ Object
Returns the value of attribute actual.
22 23 24 |
# File 'lib/testy.rb', line 22 def actual @actual end |
#expect ⇒ Object
Returns the value of attribute expect.
21 22 23 |
# File 'lib/testy.rb', line 21 def expect @expect end |
Instance Method Details
#check(name, *args) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/testy.rb', line 29 def check(name, *args) = args.last.is_a?(Hash) ? args.pop : {} value = args.size==0 ? ([:expect]||['expect']) : args.shift expect[name.to_s] = value value = args.size==0 ? ([:actual]||['actual']) : args.shift actual[name.to_s] = value end |
#empty? ⇒ Boolean
41 42 43 |
# File 'lib/testy.rb', line 41 def empty? expect.empty? and actual.empty? end |
#ok? ⇒ Boolean
37 38 39 |
# File 'lib/testy.rb', line 37 def ok? expect === actual end |