Sha256: d8ecc38f219d253dcf8761c933043efe17fe9d17fed09db71b8e231f35abe951

Contents?: true

Size: 673 Bytes

Versions: 62

Compression:

Stored size: 673 Bytes

Contents

require 'test_helper'

module Workarea
  class CopyProductTest < TestCase
    def test_perform
      product = create_product(
        id: 'FOOBAR',
        name: 'Foo Bar Product',
        slug: 'foobar',
        variants: [{ sku: 'SKU1' }]
      )

      copy = CopyProduct.new(product, id: 'FOOBAZ').perform
      assert(copy.persisted?)
      assert_equal('Foo Bar Product', copy.name)
      assert_equal('SKU1', copy.variants.first.sku)
      assert_equal('FOOBAZ', copy.id)
      assert_equal('foo-bar-product', copy.slug)

      copy = CopyProduct.new(product, id: 'FOOBAZ').perform
      refute(copy.persisted?)
      assert(copy.errors.present?)
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/services/workarea/copy_product_test.rb
workarea-core-3.5.26 test/services/workarea/copy_product_test.rb
workarea-core-3.4.45 test/services/workarea/copy_product_test.rb
workarea-core-3.5.25 test/services/workarea/copy_product_test.rb
workarea-core-3.5.23 test/services/workarea/copy_product_test.rb
workarea-core-3.4.44 test/services/workarea/copy_product_test.rb
workarea-core-3.5.22 test/services/workarea/copy_product_test.rb
workarea-core-3.4.43 test/services/workarea/copy_product_test.rb
workarea-core-3.5.21 test/services/workarea/copy_product_test.rb
workarea-core-3.4.42 test/services/workarea/copy_product_test.rb
workarea-core-3.5.20 test/services/workarea/copy_product_test.rb
workarea-core-3.4.41 test/services/workarea/copy_product_test.rb
workarea-core-3.5.19 test/services/workarea/copy_product_test.rb
workarea-core-3.4.40 test/services/workarea/copy_product_test.rb
workarea-core-3.5.18 test/services/workarea/copy_product_test.rb
workarea-core-3.4.39 test/services/workarea/copy_product_test.rb
workarea-core-3.5.17 test/services/workarea/copy_product_test.rb
workarea-core-3.4.38 test/services/workarea/copy_product_test.rb
workarea-core-3.5.16 test/services/workarea/copy_product_test.rb
workarea-core-3.4.37 test/services/workarea/copy_product_test.rb