Sha256: 4cf056e4b5dd39a71f274e0ac21f7ab479cd5b3201d5429fbd90cce1f1e22588
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
require 'test_helper' class TestPinCustomer < MiniTest::Unit::TestCase def setup FakeWeb.allow_net_connect = false end def test_update_with_blank_email FakeWeb.register_uri(:put, 'https://test-api.pin.net.au/1/customers/cus__03Cn1lSk3offZ0IGkwpCg', body: fixtures['responses']['update_customer']['blank_email']) assert_raises PinPayment::Error::InvalidResource do PinPayment::Customer.update(token: 'cus__03Cn1lSk3offZ0IGkwpCg', email: nil) end end def test_update_with_blank_token FakeWeb.register_uri(:put, 'https://test-api.pin.net.au/1/customers/', body: fixtures['responses']['update_customer']['blank_token']) assert_raises PinPayment::Error::ResourceNotFound do PinPayment::Customer.update(email: 'foo@example.com') end end def test_create_with_blank_email FakeWeb.register_uri(:post, 'https://test-api.pin.net.au/1/customers', body: fixtures['responses']['create_customer']['blank_email']) assert_raises PinPayment::Error::InvalidResource do PinPayment::Customer.create(email: nil) end end def test_create_success FakeWeb.register_uri(:post, 'https://test-api.pin.net.au/1/customers', body: fixtures['responses']['create_customer']['success']) customer = PinPayment::Customer.create(email: 'foo@example.com') assert_equal customer.token, 'cus__03Cn1lSk3offZ0IGkwpCg' end def test_update_success FakeWeb.register_uri(:put, 'https://test-api.pin.net.au/1/customers/cus__03Cn1lSk3offZ0IGkwpCg', body: fixtures['responses']['update_customer']['success']) customer = PinPayment::Customer.update(token: 'cus__03Cn1lSk3offZ0IGkwpCg', email: 'foo@example.com') assert_equal customer.token, 'cus__03Cn1lSk3offZ0IGkwpCg' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pin_payment-0.0.5 | test/test_pin_customer.rb |