Sha256: 01882d0914d32eb420c995c6ce92789348716a36896cf3e6062e8952693c227d
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
require "yaml" require "erb" class WSDLFixture # Returns a given +fixture+. Defaults to :authentication. def self.load(fixture = nil) fixture ||= :authentication method_missing fixture end # Returns a WSDL document matching a given +method+ name when called without # arguments. Otherwise returns the expected value for a given +method+ name # matching a fixture. def self.method_missing(method, *args) return wsdl(method) unless args.first expectations[method][args.first] end private @@expectations = nil # Returns a Hash of expected namespace URI's and SOAP operations loaded # from wsdl_fixture.yml. def self.expectations return @@expectations if @@expectations file = File.read File.dirname(__FILE__) + "/wsdl_fixture.yml" @@expectations = YAML.load ERB.new(file).result end @@wsdl = {} # Returns the WSDL document by a given file name. def self.wsdl(wsdl) return @@wsdl[wsdl] if @@wsdl[wsdl] file = File.read File.dirname(__FILE__) + "/xml/#{wsdl}.xml" @@wsdl[wsdl] = file end end
Version data entries
4 entries across 4 versions & 1 rubygems