Sha256: f6662a107d464278b3b81504c1dbd40fecd3dd3cf5fb0b2c2e8a31fbab6de247

Contents?: true

Size: 836 Bytes

Versions: 8

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true
require 'test_helper'

class UsageChargeTest < Test::Unit::TestCase
  def test_create_usage_charges
    fake("recurring_application_charges/654381177/usage_charges", method: :post, body: load_fixture('usage_charge'))

    usage_charge = ShopifyAPI::UsageCharge.new(description: '1000 emails', price: 1.0)
    usage_charge.prefix_options = { recurring_application_charge_id: 654381177 }
    assert(usage_charge.save)
  end

  def test_get_usage_charges
    fake(
      "recurring_application_charges/654381177/usage_charges/359376002",
      method: :get,
      status: 201,
      body: load_fixture('usage_charge')
    )

    usage_charge = ShopifyAPI::UsageCharge.find(359376002, params: { recurring_application_charge_id: 654381177 })

    assert_equal("1000 emails", usage_charge.description)
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ruby_shopify_api-1.2.0 test/usage_charge_test.rb
ruby_shopify_api-1.1.0 test/usage_charge_test.rb
ruby_shopify_api-1.0.0 test/usage_charge_test.rb
shopify_api-9.5.1 test/usage_charge_test.rb
shopify_api-9.5 test/usage_charge_test.rb
shopify_api-9.4.1 test/usage_charge_test.rb
shopify_api-9.4.0 test/usage_charge_test.rb
shopify_api-9.3.0 test/usage_charge_test.rb