Class: Testy::Test::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/testy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResult

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

#actualObject

Returns the value of attribute actual.



22
23
24
# File 'lib/testy.rb', line 22

def actual
  @actual
end

#expectObject

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)
  options = args.last.is_a?(Hash) ? args.pop : {}
  value = args.size==0 ? (options[:expect]||options['expect']) : args.shift
  expect[name.to_s] = value
  value = args.size==0 ? (options[:actual]||options['actual']) : args.shift
  actual[name.to_s] = value
end

#empty?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/testy.rb', line 41

def empty?
  expect.empty? and actual.empty?
end

#ok?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/testy.rb', line 37

def ok?
  expect === actual
end