Sha256: 4f3544926cf8dabff72dde4963f3d77e112a51e6b09983b270af8ef57bdaf279

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

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

module Stripe
  class TopupTest < Test::Unit::TestCase
    should "be listable" do
      topups = Stripe::Topup.list
      assert_requested :get, "#{Stripe.api_base}/v1/topups"
      assert topups.data.is_a?(Array)
      assert topups.data[0].is_a?(Stripe::Topup)
    end

    should "be retrievable" do
      topup = Stripe::Topup.retrieve("tu_123")
      assert_requested :get, "#{Stripe.api_base}/v1/topups/tu_123"
      assert topup.is_a?(Stripe::Topup)
    end

    should "be creatable" do
      topup = Stripe::Topup.create(
        amount: 100,
        currency: "USD",
        source: "src_123",
        description: "description",
        statement_descriptor: "statement descriptor"
      )
      assert_requested :post, "#{Stripe.api_base}/v1/topups"
      assert topup.is_a?(Stripe::Topup)
    end

    should "be saveable" do
      topup = Stripe::Topup.retrieve("tu_123")
      topup.metadata["key"] = "value"
      topup.save
      assert_requested :post, "#{Stripe.api_base}/v1/topups/#{topup.id}"
    end

    should "be updateable" do
      topup = Stripe::Topup.update("tu_123", metadata: { foo: "bar" })
      assert_requested :post, "#{Stripe.api_base}/v1/topups/tu_123"
      assert topup.is_a?(Stripe::Topup)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
stripe-3.20.0 test/stripe/topup_test.rb
stripe-3.19.0 test/stripe/topup_test.rb
stripe-3.18.0 test/stripe/topup_test.rb
stripe-3.17.2 test/stripe/topup_test.rb
stripe-3.17.1 test/stripe/topup_test.rb
stripe-3.17.0 test/stripe/topup_test.rb
stripe-3.15.0 test/stripe/topup_test.rb