class Savon::SpecHelper::Interface

Public Instance Methods

expectations() click to toggle source
# File lib/savon/mock/spec_helper.rb, line 23
def expectations
  @expectations ||= []
end
expects(operation_name) click to toggle source
# File lib/savon/mock/spec_helper.rb, line 17
def expects(operation_name)
  expectation = MockExpectation.new(operation_name)
  expectations << expectation
  expectation
end
mock!() click to toggle source
# File lib/savon/mock/spec_helper.rb, line 9
def mock!
  Savon.observers << self
end
notify(operation_name, builder, globals, locals) click to toggle source
# File lib/savon/mock/spec_helper.rb, line 27
def notify(operation_name, builder, globals, locals)
  expectation = expectations.shift

  if expectation
    expectation.actual(operation_name, builder, globals, locals)

    expectation.verify!
    expectation.response!
  else
    raise ExpectationError, "Unexpected request to the #{operation_name.inspect} operation."
  end
rescue ExpectationError
  @expectations.clear
  raise
end
unmock!() click to toggle source
# File lib/savon/mock/spec_helper.rb, line 13
def unmock!
  Savon.observers.clear
end
verify!() click to toggle source
# File lib/savon/mock/spec_helper.rb, line 43
def verify!
  return if expectations.empty?
  expectations.each(&:verify!)
rescue ExpectationError
  @expectations.clear
  raise
end