Sha256: 66ac0cde411af386b4f9c3bcf82e117d3fb265992740a87a4ecc58bfc6167d14
Contents?: true
Size: 679 Bytes
Versions: 7
Compression:
Stored size: 679 Bytes
Contents
require 'webmock/rspec' module FakeResponseHelper def fake_response(file_path, api = :NVP) endpoint = case api when :NVP Paypal::NVP::Request.endpoint when :IPN Paypal::IPN.endpoint else raise "Non-supported API: #{api}" end stub_request(:post, endpoint) .to_return( body: File.read(File.join(File.dirname(__FILE__), '../fake_response', "#{file_path}.txt")) ) end def request_to(endpoint, method = :get) raise_error( WebMock::NetConnectNotAllowedError, /Real HTTP connections are disabled. Unregistered request: #{method.to_s.upcase} #{endpoint}/ ) end end include FakeResponseHelper
Version data entries
7 entries across 7 versions & 1 rubygems