Sha256: 886a1c6e948ec572e9a6a4b7f6aaf06cc3ee40764d589935cc5ac0160f2670cf

Contents?: true

Size: 1.05 KB

Versions: 62

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'
require 'workarea/lint'

module Workarea
  class Lint
    load_lints

    class InconsistentDetailsTest < TestCase
      def test_errors_for_each_product_with_inconsistent_details
        Catalog::Product.create!(
          name: 'Foo',
          variants: [{ sku: '123', details: { 'foo' => 'bar' } }]
        )

        Catalog::Product.create!(
          name: 'Bar',
          variants: [
            { sku: '456', details: { 'foo' => 'bar' } },
            { sku: '789', details: { 'baz' => 'asdf' } }
          ]
        )

        Catalog::Product.create!(
          name: 'Baz',
          variants: [
            { sku: '012', details: { 'foo' => 'bar' } },
            { sku: '345', details: { 'foo' => '' } }
          ]
        )

        Catalog::Product.create!(
          name: 'Qux',
          variants: [
            { sku: '678', details: { 'foo' => 'bar' } },
            { sku: '901' }
          ]
        )

        lint = InconsistentDetails.new
        lint.run

        assert_equal(4, lint.warnings)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.15 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.4.36 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.14 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.4.35 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.13 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.4.34 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.12 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.4.33 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.11 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.10 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.4.32 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.9 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.4.31 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.8 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.4.30 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.7 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.4.29 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.6 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.4.28 test/lib/workarea/lint/inconsistent_details_test.rb
workarea-core-3.5.5 test/lib/workarea/lint/inconsistent_details_test.rb