Sha256: e8abf1daf16cfa8934f35bd9c0bc73dd5d134269ecc5f19c1e0f43e5c9285cac

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

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

module Stripe
  class FileLinkTest < Test::Unit::TestCase
    should "be listable" do
      file_links = Stripe::FileLink.list
      assert_requested :get, "#{Stripe.api_base}/v1/file_links"
      assert file_links.data.is_a?(Array)
      assert file_links.first.is_a?(Stripe::FileLink)
    end

    should "be retrievable" do
      file_link = Stripe::FileLink.retrieve("link_123")
      assert_requested :get, "#{Stripe.api_base}/v1/file_links/link_123"
      assert file_link.is_a?(Stripe::FileLink)
    end

    should "be creatable" do
      file_link = Stripe::FileLink.create(
        file: "file_123"
      )
      assert_requested :post, "#{Stripe.api_base}/v1/file_links"
      assert file_link.is_a?(Stripe::FileLink)
    end

    should "be saveable" do
      file_link = Stripe::FileLink.retrieve("link_123")
      file_link.metadata["key"] = "value"
      file_link.save
      assert_requested :post, "#{Stripe.api_base}/v1/file_links/#{file_link.id}"
    end

    should "be updateable" do
      file_link = Stripe::FileLink.update("link_123", metadata: { key: "value" })
      assert_requested :post, "#{Stripe.api_base}/v1/file_links/link_123"
      assert file_link.is_a?(Stripe::FileLink)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stripe-3.23.0 test/stripe/file_link_test.rb
stripe-3.22.0 test/stripe/file_link_test.rb
stripe-3.21.0 test/stripe/file_link_test.rb
stripe-3.20.0 test/stripe/file_link_test.rb