Sha256: 076241f7a2c0d7c57ac4a041b204578cd66981e669a66cc7c0f1b13dd724002a

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

require File.expand_path('../../test_helper', __FILE__)

module Stripe
  class RecipientCardTest < Test::Unit::TestCase
    FIXTURE = API_FIXTURES.fetch(:source)

    setup do
      @recipient =
        Stripe::Recipient.retrieve(API_FIXTURES.fetch(:transfer_recipient)[:id])
    end

    should "be listable" do
      cards = @recipient.cards.list
      assert cards.data.kind_of?(Array)
      assert cards.data[0].kind_of?(Stripe::Card)
    end

    should "be creatable" do
      card = @recipient.cards.create(
        card: API_FIXTURES.fetch(:token)[:id]
      )
      assert_requested :post, "#{Stripe.api_base}/v1/recipients/#{@recipient.id}/cards"
      assert card.kind_of?(Stripe::Card)
    end

    should "be deletable" do
      card = Stripe::Card.construct_from(FIXTURE.merge(recipient: @recipient.id))
      card = card.delete
      assert_requested :delete, "#{Stripe.api_base}/v1/recipients/#{@recipient.id}/cards/#{FIXTURE[:id]}"
      assert card.kind_of?(Stripe::Card)
    end

    should "be saveable" do
      card = Stripe::Card.construct_from(FIXTURE.merge(recipient: @recipient.id))
      card.metadata['key'] = 'value'
      card.save
      assert_requested :post, "#{Stripe.api_base}/v1/recipients/#{@recipient.id}/cards/#{FIXTURE[:id]}"
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
stripe-3.0.3 test/stripe/recipient_card_test.rb
stripe-3.0.1 test/stripe/recipient_card_test.rb
stripe-3.0.0 test/stripe/recipient_card_test.rb
stripe-2.12.0 test/stripe/recipient_card_test.rb
stripe-2.11.0 test/stripe/recipient_card_test.rb
stripe-2.10.0 test/stripe/recipient_card_test.rb
stripe-2.9.0 test/stripe/recipient_card_test.rb
stripe-2.8.0 test/stripe/recipient_card_test.rb
stripe-2.7.0 test/stripe/recipient_card_test.rb
stripe-2.6.0 test/stripe/recipient_card_test.rb
stripe-2.5.0 test/stripe/recipient_card_test.rb
stripe-2.4.0 test/stripe/recipient_card_test.rb
stripe-2.3.0 test/stripe/recipient_card_test.rb
stripe-2.2.1 test/stripe/recipient_card_test.rb
stripe-2.2.0 test/stripe/recipient_card_test.rb
stripe-2.1.0 test/stripe/recipient_card_test.rb
stripe-2.0.3 test/stripe/recipient_card_test.rb
stripe-2.0.2 test/stripe/recipient_card_test.rb