payment_test.rb 594 B

12345678910111213141516171819
  1. # frozen_string_literal: true
  2. require 'test_helper'
  3. class PaymentTest < Test::Unit::TestCase
  4. def setup
  5. super
  6. @checkout_id = JSON.parse(load_fixture('checkout'))['checkout']['token']
  7. @expected_payment = JSON.parse(load_fixture('payment'))['payment']
  8. end
  9. test ":create creates a new payment" do
  10. fake "checkouts/#{@checkout_id}/payments", method: :post, status: 201, body: load_fixture('payment')
  11. new_payment = ShopifyAPI::Payment.create(checkout_id: @checkout_id)
  12. assert_equal @expected_payment['unique_token'], new_payment.attributes['unique_token']
  13. end
  14. end