Sha256: 192b803113163996f069cf9b50ef3423f7f97377eb3784f325f8ef41de52bee2

Contents?: true

Size: 962 Bytes

Versions: 3

Compression:

Stored size: 962 Bytes

Contents

require 'test_helper'
require 'razorpay/payment'
require 'razorpay/refund'

module Razorpay
  # Tests for Razorpay::Refund
  class RazorpayRefundTest < Minitest::Test
    def setup
      @payment_id = 'fake_payment_id'
      stub_get(%r{payments\/#{Regexp.quote(@payment_id)}$}, 'fake_payment')
    end

    def test_refund_should_be_defined
      refute_nil Razorpay::Refund
    end

    def test_fetch_all_refunds
      stub_get(%r{payments/#{@payment_id}/refunds$}, 'refund_collection')
      refunds = Razorpay::Payment.fetch(@payment_id).refunds.all
      assert_instance_of Razorpay::Collection, refunds
    end

    def test_fetch_specific_refund
      refund_id = 'fake_refund_id'
      stub_get(%r{payments/#{@payment_id}/refunds/#{refund_id}$}, 'fake_refund')
      refund = Razorpay::Payment.fetch(@payment_id).refunds.fetch('fake_refund_id')
      assert_instance_of Razorpay::Refund, refund
      assert_equal refund.id, refund_id
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
razorpay-1.2.1 test/razorpay/test_refund.rb
razorpay-1.2.0 test/razorpay/test_refund.rb
razorpay-1.1.0 test/razorpay/test_refund.rb