Sha256: c223c66148dc5c26b6b60dae1ca53359299544bc56b359866ea2684921e53053

Contents?: true

Size: 1.53 KB

Versions: 4

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

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

module Stripe
  module Issuing
    class DisputeTest < Test::Unit::TestCase
      should "be creatable" do
        dispute = Stripe::Issuing::Dispute.create(
          reason: "fraudulent",
          transaction: "ipi_123"
        )
        assert_requested :post, "#{Stripe.api_base}/v1/issuing/disputes"
        assert dispute.is_a?(Stripe::Issuing::Dispute)
      end

      should "be listable" do
        disputes = Stripe::Issuing::Dispute.list
        assert_requested :get, "#{Stripe.api_base}/v1/issuing/disputes"
        assert disputes.data.is_a?(Array)
        assert disputes.data[0].is_a?(Stripe::Issuing::Dispute)
      end

      should "be retrievable" do
        dispute = Stripe::Issuing::Dispute.retrieve("ich_123")
        assert_requested :get, "#{Stripe.api_base}/v1/issuing/disputes/ich_123"
        assert dispute.is_a?(Stripe::Issuing::Dispute)
      end

      should "be saveable" do
        dispute = Stripe::Issuing::Dispute.retrieve("ich_123")
        dispute.metadata["key"] = "value"
        dispute.save
        assert_requested :post, "#{Stripe.api_base}/v1/issuing/disputes/#{dispute.id}"
        assert dispute.is_a?(Stripe::Issuing::Dispute)
      end

      should "be updateable" do
        dispute = Stripe::Issuing::Dispute.update("ich_123", metadata: { foo: "bar" })
        assert_requested :post, "#{Stripe.api_base}/v1/issuing/disputes/ich_123"
        assert dispute.is_a?(Stripe::Issuing::Dispute)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stripe-3.26.1 test/stripe/issuing/dispute_test.rb
stripe-3.26.0 test/stripe/issuing/dispute_test.rb
stripe-3.25.0 test/stripe/issuing/dispute_test.rb
stripe-3.24.0 test/stripe/issuing/dispute_test.rb