Sha256: 69544a837c04db42f76a06265cfd7941d9dc5342ca9e0c6a259270b96202ecc9

Contents?: true

Size: 904 Bytes

Versions: 3

Compression:

Stored size: 904 Bytes

Contents

require 'test_helper'

module Workarea
  class Emarsys::SyncOrdersTest < TestCase
    include EmarsysApiConfig

    def test_sync_orders_sends_file
      merchant_id = "19CAA097101B372A"
      Workarea.config.merchant_id = merchant_id

      VCR.use_cassette("emarsys/sales/send_data", match_requests_on: [:method, :uri]) do
        api_url = "https://admin.scarabresearch.com/hapi/merchant/#{merchant_id}/sales-data/api"

        create_placed_order

        Workarea::Emarsys::SyncOrders.new.perform

        assert_requested :post, api_url
      end
    end

    def test_sync_orders_sends_nothing_when_no_orders
      merchant_id = "19CAA097101B372A"
      Workarea.config.merchant_id = merchant_id

      api_url = "https://admin.scarabresearch.com/hapi/merchant/#{merchant_id}/sales-data/api"
      Workarea::Emarsys::SyncOrders.new.perform

      refute_requested :post, api_url
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-emarsys-2.0.1 test/workers/workarea/emarsys/sync_orders_test.rb
workarea-emarsys-2.0.0 test/workers/workarea/emarsys/sync_orders_test.rb
workarea-emarsys-1.1.0 test/workers/workarea/emarsys/sync_orders_test.rb