Sha256: be0a8e8168321a33c1c2b073cef73c00c4b6690a61aaae414391385bda940f0b

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true
require 'test_helper'

class ApplicationCreditTest < Test::Unit::TestCase
  def test_application_credit_create
    fake("application_credits", method: :post, status: 201, body: load_fixture('application_credit'))

    credit = ShopifyAPI::ApplicationCredit.create(
      description: "refund for application charge",
      amount: 5.00,
      api_client_id: 861378,
      shop_id: 487168
    )

    assert_equal('refund for application charge', credit.description)
    assert_equal('5.00', credit.amount)
  end

  def test_get_application_credit
    fake("application_credits/803742", method: :get, status: 201, body: load_fixture('application_credit'))

    credit = ShopifyAPI::ApplicationCredit.find(803742)

    assert_equal('refund for application charge', credit.description)
    assert_equal('5.00', credit.amount)
  end

  def test_list_application_credits
    fake("application_credits", method: :get, status: 201, body: load_fixture('application_credits'))

    credit = ShopifyAPI::ApplicationCredit.find(:all)

    assert_equal(2, credit.size)
    assert_equal('10.00', credit.last.amount)
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

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