Sha256: 5ddf0c40c0c01dda98e8db8acacf491d6905385bc276d847a8f7cce076f4266b

Contents?: true

Size: 975 Bytes

Versions: 18

Compression:

Stored size: 975 Bytes

Contents

require 'httpi/adapter/httpclient'

# Proxy adapter. Records all requests and passes them to HTTPClient
class AdapterForTest < HTTPI::Adapter::Base

  register :adapter_for_test

  def initialize(request)
    @@requests ||= []
    @@requests.push request
    @request = request
    @worker = HTTPI::Adapter::HTTPClient.new(request)
  end

  def client
    @worker.client
  end

  def request(method)
    @@methods ||= []
    @@methods.push method
    @worker.request(method)
  end

end

# Fake adapter with request recording.
# Takes path from url and returns fixture WSDL with that name.
class FakeAdapterForTest < HTTPI::Adapter::Base

  register :fake_adapter_for_test

  def initialize(request)
    @@requests ||= []
    @@requests.push request
    @request = request
  end

  attr_reader :client

  def request(method)
    @@methods ||= []
    @@methods.push method
    target = @request.url.path.to_sym
    HTTPI::Response.new(200, {}, Fixture.wsdl(target))
  end

end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
savon-2.12.1 spec/support/adapters.rb
savon-2.12.0 spec/support/adapters.rb
savon-2.11.2 spec/support/adapters.rb
savon-SU-2.11.1b spec/support/adapters.rb
savon-SU-2.11.1 spec/support/adapters.rb
savon-2.11.1 spec/support/adapters.rb
savon-2.11.0 spec/support/adapters.rb
savon-2.10.1 spec/support/adapters.rb
savon-2.10.0 spec/support/adapters.rb
savon-2.9.0 spec/support/adapters.rb
savon-2.8.1 spec/support/adapters.rb
savon-2.8.0 spec/support/adapters.rb
savon-2.7.2 spec/support/adapters.rb
savon-2.7.1 spec/support/adapters.rb
savon-2.7.0 spec/support/adapters.rb
savon-2.6.0 spec/support/adapters.rb
savon-2.5.1 spec/support/adapters.rb
savon-2.5.0 spec/support/adapters.rb