Sha256: 9905096225263fab4a8d5527e7121370c5d66d75e5b8735228ad522b1b12d3b4

Contents?: true

Size: 960 Bytes

Versions: 2

Compression:

Stored size: 960 Bytes

Contents

require 'test_helper'

module Workarea
  class SaveUserOrderDetailsTest < Workarea::TestCase
    setup :setup_sidekiq
    teardown :teardown_sidekiq

    def test_not_enqueued_for_global_e_orders
      user = create_user(email: 'foo@baz.com')
      _order = create_placed_order(
        global_e: true,
        email: 'foo@bar.com',
        user_id: user.id
      )

      assert_equal 0, Workarea::SaveUserOrderDetails.jobs.size

      _order = create_placed_order(
        id: "12345",
        email: 'foo@bar.com',
        user_id: user.id
      )

      assert_equal 1, Workarea::SaveUserOrderDetails.jobs.size
    end

    private

      def setup_sidekiq
        Sidekiq::Testing.fake!
        Sidekiq::Callbacks.async(Workarea::SaveUserOrderDetails)
        Sidekiq::Callbacks.enable(Workarea::SaveUserOrderDetails)

        Workarea::SaveUserOrderDetails.drain
      end

      def teardown_sidekiq
        Sidekiq::Testing.inline!
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-global_e-1.3.0 test/workers/workarea/global_e_save_user_order_details_test.rb
workarea-global_e-1.2.1 test/workers/workarea/global_e_save_user_order_details_test.rb