Module: Adyen::API::RecurringService::TestHelpers

Included in:
Adyen::API::RecurringService
Defined in:
lib/adyen/api/test_helpers.rb

Overview

A collection of test helpers that create and assign stubbed response instances for a subsequent remote call.

This module extends the Adyen::API::RecurringService class and thus these methods are callable on it.

Constant Summary

DISABLE_RESPONSE =
SimpleSOAPClient::ENVELOPE % <<EOS
    <ns1:disableResponse xmlns:ns1="http://recurring.services.adyen.com">
      <ns1:result>
        <response xmlns="http://recurring.services.adyen.com">
          %s
        </response>
      </ns1:result>
    </ns1:disableResponse>
EOS

Instance Method Summary (collapse)

Instance Method Details

- (DisableResponse) disabled_stub

Returns A ‘disable succeeded’ response instance.

Returns:



118
119
120
121
122
# File 'lib/adyen/api/test_helpers.rb', line 118

def disabled_stub
  http_response = Net::HTTPOK.new('1.1', '200', 'OK')
  def http_response.body; DISABLE_RESPONSE % DisableResponse::DISABLED_RESPONSES.first; end
  RecurringService::DisableResponse.new(http_response)
end

- (Object) stub_disabled!

Assigns a #disabled_stub, meaning the subsequent disable request will be successful.



125
126
127
# File 'lib/adyen/api/test_helpers.rb', line 125

def stub_disabled!
  @stubbed_response = disabled_stub
end