Sha256: 1690a9c0aff56689d28fc6371a06ac9ba3dbcc2fc4b16876fec3805052011343

Contents?: true

Size: 880 Bytes

Versions: 5

Compression:

Stored size: 880 Bytes

Contents

require 'test_helper'

module Workarea
  module Search
    class StorefrontTest < TestCase
      def test_active
        model = create_product(active: false)
        refute(Storefront.new(model).active[:now])

        model.update!(active: true)
        assert(Storefront.new(model).active[:now])
      end

      def test_changesets
        category = create_category(
          name: 'Foo',
          product_rules: [{ name: 'search', operator: 'equals', value: 'foo' }]
        )
        assert_empty(Storefront.new(category).changesets)

        release = create_release
        release.as_current { category.update!(name: 'Bar') }
        assert_equal(1, Storefront.new(category).changesets.size)

        release.as_current { category.product_rules.first.update!(value: 'bar') }
        assert_equal(2, Storefront.new(category).changesets.size)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
workarea-core-3.5.12 test/models/workarea/search/storefront_test.rb
workarea-core-3.5.11 test/models/workarea/search/storefront_test.rb
workarea-core-3.5.10 test/models/workarea/search/storefront_test.rb
workarea-core-3.5.9 test/models/workarea/search/storefront_test.rb
workarea-core-3.5.8 test/models/workarea/search/storefront_test.rb