Sha256: b6a92c53c01ec38b03da077e61c16e7686e9a43ae1d7e0549303cf0b9526c7ab

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

require 'simplecov'
require 'minitest/autorun'
require 'webmock/minitest'

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.merge!(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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
razorpay-1.0.3 test/test_helper.rb
razorpay-1.0.2 test/test_helper.rb
razorpay-1.0.1 test/test_helper.rb
razorpay-1.0.0 test/test_helper.rb