Sha256: 47fb04a6ed8a6c46cfa0a024dcbdde3f27ccfd041ea15ff1cac1690f74f18d68
Contents?: true
Size: 1.19 KB
Versions: 32
Compression:
Stored size: 1.19 KB
Contents
require "savon/mock" module Savon module SpecHelper class Interface def mock! Savon.observers << self end def unmock! Savon.observers.clear end def expects(operation_name) expectation = MockExpectation.new(operation_name) expectations << expectation expectation end def expectations @expectations ||= [] end 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 def verify! return if expectations.empty? expectations.each(&:verify!) rescue ExpectationError @expectations.clear raise end end def savon @savon ||= Interface.new end def verify_mocks_for_rspec super if defined? super savon.verify! end end end
Version data entries
32 entries across 32 versions & 4 rubygems