Sha256: 60d1e61338d3a8c2d82a414474c90368c6db5037157f69918a0d757f2cb9159d
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require 'coveralls' require 'simplecov' require 'minitest/autorun' require 'webmock/minitest' require 'razorpay' Coveralls.wear! if ENV['CI'] def fixture_file(filename) return '' if filename == '' file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename + '.json') File.read(file_path) end def stub_response(_url, filename, status = nil) response = { body: fixture_file(filename) } response[:status] = status unless status.nil? response.merge!(headers: { 'Content-Type' => 'application/json' }) end def stub_get(*args) response = stub_response(*args) url = args[0] stub_request(:get, url).to_return(response) end def stub_post(*args) # The last argument is post data data = args.pop response = stub_response(*args) url = args[0] stub_request(:post, url).with(body: data).to_return(response) end def stub_put(*args) # The last argument is put data data = args.pop response = stub_response(*args) url = args[0] stub_request(:put, url).with(body: data).to_return(response) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
razorpay-2.0.1 | test/test_helper.rb |
razorpay-2.0.0 | test/test_helper.rb |