Sha256: ebdc37052c0de8f4a1d9cb86e73fe59b9120d9e1b4de45f78429827ef5637628

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

require 'test_helper'

class FulFillmentRequestTest < Test::Unit::TestCase
  def setup
    fake "orders/450789469/fulfillment_requests/695890229", method: :get, body: load_fixture('fulfillment_request')
  end

  context "#mark_as_failed" do
    should "be able to mark_as_failed a fulfillment request" do
      fulfillment_request = ShopifyAPI::FulfillmentRequest.find(255858046, params: { order_id: 450789469 })

      cancelled = ActiveSupport::JSON.decode(load_fixture('fulfillment_request'))
      cancelled['failure_message'] = 'failure reason'
      fake "orders/450789469/fulfillment_requests/695890229/mark_as_failed", method: :put, body: ActiveSupport::JSON.encode(cancelled)

      assert fulfillment_request.failure_message.blank?
      assert fulfillment_request.mark_as_failed
      assert_equal 'failure reason', fulfillment_request.failure_message
    end
  end

  context "#find" do
    should "be able to find fulfillment request" do
      fulfillment_request = ShopifyAPI::FulfillmentRequest.find(255858046, params: { order_id: 450789469 })
      assert_equal 695890229, fulfillment_request.id
      assert_equal 450789469, fulfillment_request.order_id
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shopify_api-4.3.4 test/fulfillment_request_test.rb
shopify_api-4.3.3 test/fulfillment_request_test.rb
shopify_api-4.3.2 test/fulfillment_request_test.rb
shopify_api-4.3.1 test/fulfillment_request_test.rb