Sha256: bf7f22f6fc25a78394c26a23fe31ac088e3b816742d91a186c9fcf85b6a52912
Contents?: true
Size: 753 Bytes
Versions: 56
Compression:
Stored size: 753 Bytes
Contents
require 'fakeweb' module FakeResponseHelper def fake_response(file_path, api = :NVP, options = {}) endpoint = case api when :NVP Paypal::NVP::Request.endpoint when :IPN Paypal::IPN.endpoint else raise "Non-supported API: #{api}" end FakeWeb.register_uri( :post, endpoint, options.merge( :body => File.read(File.join(File.dirname(__FILE__), '../fake_response', "#{file_path}.txt")) ) ) end def request_to(endpoint, method = :get) raise_error( FakeWeb::NetConnectNotAllowedError, "Real HTTP connections are disabled. Unregistered request: #{method.to_s.upcase} #{endpoint}" ) end end FakeWeb.allow_net_connect = false include FakeResponseHelper
Version data entries
56 entries across 56 versions & 3 rubygems