Sha256: 4fe408d347d958674bf3c0ab321ecebc2f46157803d5eb5a6387ea08c2ee22fe

Contents?: true

Size: 1.38 KB

Versions: 18

Compression:

Stored size: 1.38 KB

Contents

require 'test_helper'

class FulFillmentTest < Test::Unit::TestCase
  def setup
    fake "orders/450789469/fulfillments/255858046", :method => :get, :body => load_fixture('fulfillment')
  end

  context "Fulfillment" do
    context "#complete" do
      should "be able to complete fulfillment" do
        fulfillment = ShopifyAPI::Fulfillment.find(255858046, :params => {:order_id => 450789469})

        success = ActiveSupport::JSON.decode(load_fixture('fulfillment'))
        success['fulfillment']['status'] = 'success'
        fake "orders/450789469/fulfillments/255858046/complete", :method => :post, :body => ActiveSupport::JSON.encode(success)

        assert_equal 'pending', fulfillment.status
        assert fulfillment.complete
        assert_equal 'success', fulfillment.status
      end
    end

    context "#cancel" do
      should "be able to cancel fulfillment" do
        fulfillment = ShopifyAPI::Fulfillment.find(255858046, :params => {:order_id => 450789469})

        cancelled = ActiveSupport::JSON.decode(load_fixture('fulfillment'))
        cancelled['fulfillment']['status'] = 'cancelled'
        fake "orders/450789469/fulfillments/255858046/cancel", :method => :post, :body => ActiveSupport::JSON.encode(cancelled)

        assert_equal 'pending', fulfillment.status
        assert fulfillment.cancel
        assert_equal 'cancelled', fulfillment.status
      end
    end
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
shopify_api-4.2.0 test/fulfillment_test.rb
shopify_api-4.1.1 test/fulfillment_test.rb
shopify_api-4.1.0 test/fulfillment_test.rb
shopify_api-4.0.7 test/fulfillment_test.rb
shopify_api-4.0.6 test/fulfillment_test.rb
shopify_api-4.0.5 test/fulfillment_test.rb
shopify_api-4.0.4 test/fulfillment_test.rb
shopify_api-4.0.3 test/fulfillment_test.rb
shopify_api-4.0.2 test/fulfillment_test.rb
shopify_api-4.0.1 test/fulfillment_test.rb
shopify_api-4.0.0 test/fulfillment_test.rb
shopify_api-3.2.7 test/fulfillment_test.rb
shopify_api-3.2.6 test/fulfillment_test.rb
shopify_api-3.2.5 test/fulfillment_test.rb
shopify_api-3.2.4 test/fulfillment_test.rb
shopify_api-3.2.3 test/fulfillment_test.rb
shopify_api-3.2.2 test/fulfillment_test.rb
shopify_api-3.2.1 test/fulfillment_test.rb