Sha256: 2e85a1bf0a58b6144d24ba30fe8f8d81156a793f7a3ea08d9ce450efa10dd65b

Contents?: true

Size: 955 Bytes

Versions: 2

Compression:

Stored size: 955 Bytes

Contents

require 'test_helper'

module Workarea
  module Storefront
    class ShipStationWebhookTest < Workarea::IntegrationTest
      def test_resource_url
        post storefront.ship_station_webhook_path, params: invalid_payload, as: :json
        refute(response.ok?)
        assert_equal(400, response.status)
      end

      def test_no_processor
        post storefront.ship_station_webhook_path, params: no_processor_payload, as: :json

        refute(response.ok?)
        assert(response.body.include? "no class defined to handle FOO_BAR_BAZ")
         assert_equal(404, response.status)
      end

      private

      def invalid_payload
        {
          "resource_url": "https://ssapiX.example.com",
          "resource_type": "ITEM_SHIP_NOTIFY"
        }
      end

      def no_processor_payload
        {
          "resource_url": "https://ssapiX.shipstation.com",
          "resource_type": "FOO_BAR_BAZ"
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-ship_station-1.0.1 test/integration/workarea/storefront/ship_station_webhook_test.rb
workarea-ship_station-1.0.0 test/integration/workarea/storefront/ship_station_webhook_test.rb