Sha256: ccaa554e32587ddc777c5dc8acdffa0f744c0338a095611309ebf253f34a6d9a

Contents?: true

Size: 774 Bytes

Versions: 36

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true

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

module Stripe
  class UsageRecordTest < Test::Unit::TestCase
    should "be creatable" do
      usage_record = Stripe::UsageRecord.create(
        quantity: 5000,
        subscription_item: "si_abc",
        timestamp: Time.now.to_i,
        action: "increment"
      )
      assert_requested :post, "#{Stripe.api_base}/v1/subscription_items/si_abc/usage_records"
      assert usage_record.is_a?(Stripe::UsageRecord)
    end

    should "raise when subscription_item is missing" do
      assert_raise ArgumentError do
        Stripe::UsageRecord.create(
          quantity: 5000,
          timestamp: Time.now.to_i,
          action: "increment"
        )
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
stripe-4.18.0 test/stripe/usage_record_test.rb
stripe-4.17.0 test/stripe/usage_record_test.rb
stripe-4.16.0 test/stripe/usage_record_test.rb
stripe-4.15.0 test/stripe/usage_record_test.rb
stripe-4.14.0 test/stripe/usage_record_test.rb
stripe-4.13.0 test/stripe/usage_record_test.rb
stripe-4.12.0 test/stripe/usage_record_test.rb
stripe-4.11.0 test/stripe/usage_record_test.rb
stripe-4.10.0 test/stripe/usage_record_test.rb
stripe-4.9.1 test/stripe/usage_record_test.rb
stripe-4.9.0 test/stripe/usage_record_test.rb
stripe-4.8.1 test/stripe/usage_record_test.rb
stripe-4.8.0 test/stripe/usage_record_test.rb
stripe-4.7.1 test/stripe/usage_record_test.rb
stripe-4.7.0 test/stripe/usage_record_test.rb
stripe-4.6.0 test/stripe/usage_record_test.rb
stripe-4.5.0 test/stripe/usage_record_test.rb
stripe-4.4.1 test/stripe/usage_record_test.rb
stripe-4.4.0 test/stripe/usage_record_test.rb
stripe-4.3.0 test/stripe/usage_record_test.rb