class Defekt::Mock

Public Instance Methods

expect(methot, value, arguments=[]) click to toggle source
# File lib/defekt/mock.rb, line 3
def expect(methot, value, arguments=[])
  expected_calls.push([methot, arguments])

  define_singleton_method(methot) do |*args|
    actual_calls.push([methot, args])
    value
  end

  self
end
verify() click to toggle source
# File lib/defekt/mock.rb, line 14
def verify
  expected_calls.uniq.sort == actual_calls.uniq.sort
end

Private Instance Methods

actual_calls() click to toggle source
# File lib/defekt/mock.rb, line 24
def actual_calls
  @actual_calls ||= []
end
expected_calls() click to toggle source
# File lib/defekt/mock.rb, line 20
def expected_calls
  @expected_calls ||= []
end