Sha256: 551b5ee29c7b50e6a07c00674453553893dfd5a6bb79f54f26100ea3bd874ff6

Contents?: true

Size: 630 Bytes

Versions: 3

Compression:

Stored size: 630 Bytes

Contents

require 'test_helper'
require 'razorpay/entity'
require 'razorpay/errors/bad_request_error'

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

    def test_bad_request_error
      stub_post(%r{payments/#{@payment_id}/capture$}, 'bad_request_error', 'amount=5')
      assert_raises Razorpay::BadRequestError, 'It must raise BadRequestError' do
        payment = Razorpay::Payment.fetch(@payment_id)
        payment.capture(amount: 5)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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