Sha256: 13e71105562268934999c2bf5152a00c73bc24d02d8ba85702a42327c516116a

Contents?: true

Size: 772 Bytes

Versions: 10

Compression:

Stored size: 772 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

10 entries across 10 versions & 1 rubygems

Version Path
stripe-3.23.0 test/stripe/usage_record_test.rb
stripe-3.22.0 test/stripe/usage_record_test.rb
stripe-3.21.0 test/stripe/usage_record_test.rb
stripe-3.20.0 test/stripe/usage_record_test.rb
stripe-3.19.0 test/stripe/usage_record_test.rb
stripe-3.18.0 test/stripe/usage_record_test.rb
stripe-3.17.2 test/stripe/usage_record_test.rb
stripe-3.17.1 test/stripe/usage_record_test.rb
stripe-3.17.0 test/stripe/usage_record_test.rb
stripe-3.15.0 test/stripe/usage_record_test.rb