Sha256: b506d87469d6d38a755eefc800657fe27aa0e38f2c5e0e323f3c2ba6e94eb2a3

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'test_helper'

module Workarea
  module FlowIo
    class ItemExporterTest < Workarea::TestCase
      include Workers

      def test_exporting_from_product_save
        Sidekiq::Callbacks.enable(FlowIo::ItemExporter) do
          BogusClient::Items.any_instance.expects(:put_by_number).times(3)

          create_product(
            variants: [
              { sku: 'SKU1', regular: 5.00 },
              { sku: 'SKU2', regular: 5.00 },
            ]
          )
          Pricing::Sku.find("SKU2").tap do |sku|
            sku.prices.first.regular = 6.00
            sku.save
          end
        end
      end

      def test_exporting_from_updating_price
        create_product(
          variants: [
            { sku: 'SKU1', regular: 5.00 }
          ]
        )
        pricing_sku = Pricing::Sku.find('SKU1')
        price = pricing_sku.prices.first

        Sidekiq::Callbacks.enable(FlowIo::ItemExporter) do
          BogusClient::Items.any_instance.expects(:put_by_number).times(1)

          price.update_attributes(
            regular: 0.44,
            sale: 0.30,
            min_quantity: 1,
            active: true
          )
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 test/workers/workarea/flow_io/item_exporter_test.rb