checkouts_test.rb 717 B

12345678910111213141516171819
  1. require 'test_helper'
  2. class CheckoutsTest < Test::Unit::TestCase
  3. test "get all checkouts indexed by token" do
  4. fake 'checkouts', method: :get, status: 200, body: load_fixture('checkouts')
  5. checkout = ShopifyAPI::Checkout.all
  6. assert_equal '2a1ace52255252df566af0faaedfbfa7', checkout.first.id
  7. end
  8. test ":complete completes a checkout" do
  9. checkout_id = JSON.parse(load_fixture('checkout'))['checkout']['id']
  10. fake "checkouts/#{checkout_id}", method: :get, status: 200, body: load_fixture('checkout')
  11. checkout = ShopifyAPI::Checkout.find(checkout_id)
  12. fake "checkouts/#{checkout.id}/complete", method: :post, status: 200, body: load_fixture('checkouts')
  13. checkout.complete
  14. end
  15. end