Sha256: 4854dcd02c860271bef5254f27e755c28a5b80fefb26d3de5f9496537a1714da

Contents?: true

Size: 926 Bytes

Versions: 7

Compression:

Stored size: 926 Bytes

Contents

require 'test_helper'

class TestPinCard < MiniTest::Unit::TestCase
  def setup
    common_setup
  end

  def test_successful_card
    FakeWeb.register_uri(:post, 'https://test-api.pin.net.au/1/cards', body: fixtures['responses']['card']['success'])
    card = PinPayment::Card.create(card_hash)
    assert_equal 'XXXX-XXXX-XXXX-0000', card.display_number
    assert_equal 'master', card.scheme
  end

  def test_invalid_card
    FakeWeb.register_uri(:post, 'https://test-api.pin.net.au/1/cards', body: fixtures['responses']['card']['invalid'])
    assert_raises PinPayment::Error::InvalidResource do
      PinPayment::Card.create(card_hash.merge(number: 5520000000000099))
    end
  end

  def test_new_from_hash
    card = PinPayment::Card.new(nil, card_hash)
    assert_kind_of PinPayment::Card, card
  end

  def test_to_hash
    card = PinPayment::Card.new(nil, card_hash)
    assert_kind_of Hash, card.to_hash
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pin_payment-0.5.2 test/test_pin_card.rb
pin_payment-0.5.1 test/test_pin_card.rb
pin_payment-0.5.0 test/test_pin_card.rb
pin_payment-0.4.0 test/test_pin_card.rb
pin_payment-0.3.0 test/test_pin_card.rb
pin_payment-0.2.0 test/test_pin_card.rb
pin_payment-0.1.0 test/test_pin_card.rb