application_credit_test.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. require 'test_helper'
  2. class ApplicationCreditTest < Test::Unit::TestCase
  3. def test_application_credit_create
  4. fake("application_credits", method: :post, status: 201, body: load_fixture('application_credit'))
  5. credit = ShopifyAPI::ApplicationCredit.create(
  6. description: "refund for application charge",
  7. amount: 5.00,
  8. api_client_id: 861378,
  9. shop_id: 487168
  10. )
  11. assert_equal('refund for application charge', credit.description)
  12. assert_equal('5.00', credit.amount)
  13. end
  14. def test_get_application_credit
  15. fake("application_credits/803742", method: :get, status: 201, body: load_fixture('application_credit'))
  16. credit = ShopifyAPI::ApplicationCredit.find(803742)
  17. assert_equal('refund for application charge', credit.description)
  18. assert_equal('5.00', credit.amount)
  19. end
  20. def test_list_application_credits
  21. fake("application_credits", method: :get, status: 201, body: load_fixture('application_credits'))
  22. credit = ShopifyAPI::ApplicationCredit.find(:all)
  23. assert_equal(2, credit.size)
  24. assert_equal('10.00', credit.last.amount)
  25. end
  26. end