Sha256: 175e83d9815680eb3c73510748ad342dda702e1a37ce3db97e3ceedef8ac1090

Contents?: true

Size: 1.22 KB

Versions: 37

Compression:

Stored size: 1.22 KB

Contents

require 'test_helper'

class FulFillmentRequestTest < Test::Unit::TestCase
  def setup
    super
    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(695890229, params: { order_id: 450789469 })

      cancelled = ActiveSupport::JSON.decode(load_fixture('fulfillment_request'))
      cancelled['failure_message'] = 'failure reason'
      cancelled['message'] = nil
      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(695890229, params: { order_id: 450789469 })
      assert_equal 695890229, fulfillment_request.id
      assert_equal 450789469, fulfillment_request.order_id
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
shopify_api-9.2.0 test/fulfillment_request_test.rb
shopify_api-9.1.0 test/fulfillment_request_test.rb
shopify_api-9.0.4 test/fulfillment_request_test.rb
shopify_api-9.0.3 test/fulfillment_request_test.rb
shopify_api-9.0.2 test/fulfillment_request_test.rb
shopify_api-9.0.1 test/fulfillment_request_test.rb
shopify_api-9.0.0 test/fulfillment_request_test.rb
shopify_api-8.1.0 test/fulfillment_request_test.rb
shopify_api-8.0.0 test/fulfillment_request_test.rb
shopify_api-7.1.0 test/fulfillment_request_test.rb
shopify_api-7.0.2 test/fulfillment_request_test.rb
shopify_api-7.0.1 test/fulfillment_request_test.rb
shopify_api-7.0.0 test/fulfillment_request_test.rb
shopify_api-6.0.0 test/fulfillment_request_test.rb
shopify_api-5.2.4 test/fulfillment_request_test.rb
shopify_api-5.2.3 test/fulfillment_request_test.rb
shopify_api-5.2.2 test/fulfillment_request_test.rb
shopify_api-5.2.1 test/fulfillment_request_test.rb
shopify_api-5.2.0 test/fulfillment_request_test.rb
shopify_api-5.1.0 test/fulfillment_request_test.rb