class Savon::SpecHelper::Interface

Public Instance Methods

expectations() click to toggle source
# File lib/savon/mock/spec_helper.rb, line 22
def expectations
  @expectations ||= []
end
expects(operation_name) click to toggle source
# File lib/savon/mock/spec_helper.rb, line 16
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 8
def mock!
  Savon.observers << self
end
notify(operation_name, builder, globals, locals) click to toggle source
# File lib/savon/mock/spec_helper.rb, line 26
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 12
def unmock!
  Savon.observers.clear
end
verify!() click to toggle source
# File lib/savon/mock/spec_helper.rb, line 42
def verify!
  return if expectations.empty?
  expectations.each(&:verify!)
rescue ExpectationError
  @expectations.clear
  raise
end