Sha256: f5229fac4702df8df3f66abe3afb73449d0a385d48dc0a3995cdd6a88c9ddc0d

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 Bytes

Contents

require 'test_helper'

class TestPinCharge < MiniTest::Unit::TestCase
  def setup
    FakeWeb.allow_net_connect = false
  end

  def test_invalid_amount
    FakeWeb.register_uri(:post, 'https://test-api.pin.net.au/1/charges', body: fixtures['responses']['charge']['invalid_amount'])
    assert_raises PinPayment::Error::InvalidResource do
      PinPayment::Charge.create(customer_token: 'cus__03Cn1lSk3offZ0IGkwpCg', amount: 10.0)
    end
  end

  def test_successful_charge
    FakeWeb.register_uri(:post, 'https://test-api.pin.net.au/1/charges', body: fixtures['responses']['charge']['success'])
    charge = PinPayment::Charge.create(customer_token: 'cus__03Cn1lSk3offZ0IGkwpCg', amount: 1000)
    assert_equal true, charge.success?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pin_payment-0.0.5 test/test_pin_charge.rb