Sha256: dd5acd2b94ec5fc25e3f747a4f9e1b70f2db8575dcbccd3adc3f4813682e2c5b

Contents?: true

Size: 915 Bytes

Versions: 27

Compression:

Stored size: 915 Bytes

Contents

require "yaml"
require "erb"

class WSDLFixture

  # 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

27 entries across 27 versions & 6 rubygems

Version Path
savon-xaop-0.7.2.7 spec/fixtures/wsdl/wsdl_fixture.rb
savon-xaop-0.7.2.6 spec/fixtures/wsdl/wsdl_fixture.rb
johnreitano-savon-0.7.7.5 spec/fixtures/wsdl/wsdl_fixture.rb
johnreitano-savon-0.7.7.4 spec/fixtures/wsdl/wsdl_fixture.rb
johnreitano-savon-0.7.7.3 spec/fixtures/wsdl/wsdl_fixture.rb
johnreitano-savon-0.7.7.2 spec/fixtures/wsdl/wsdl_fixture.rb
tictoc-savon-0.7.9 spec/fixtures/wsdl/wsdl_fixture.rb
savon-xaop-0.7.2.5 spec/fixtures/wsdl/wsdl_fixture.rb
pyu-savon-0.7.9.3 spec/fixtures/wsdl/wsdl_fixture.rb
johnreitano-savon-0.7.7.1 spec/fixtures/wsdl/wsdl_fixture.rb
johnreitano-savon-0.7.2.1 spec/fixtures/wsdl/wsdl_fixture.rb
savon-xaop-0.7.2.4 spec/fixtures/wsdl/wsdl_fixture.rb
savon-xaop-0.7.2.3 spec/fixtures/wsdl/wsdl_fixture.rb
hoopla-savon-0.7.9 spec/fixtures/wsdl/wsdl_fixture.rb
savon-0.7.9 spec/fixtures/wsdl/wsdl_fixture.rb
savon-0.7.8 spec/fixtures/wsdl/wsdl_fixture.rb
savon-0.7.7 spec/fixtures/wsdl/wsdl_fixture.rb
savon-xaop-0.7.2.2 spec/fixtures/wsdl/wsdl_fixture.rb
hoopla-savon-0.7.6 spec/fixtures/wsdl/wsdl_fixture.rb
savon-0.7.6 spec/fixtures/wsdl/wsdl_fixture.rb