Sha256: 0b02c2e33575f23762ea7e7765346b6c406da40687ef04bea001c39ab78cdaf4

Contents?: true

Size: 1.05 KB

Versions: 62

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'

module Workarea
  module Catalog
    class CategoryTest < TestCase
      include FeaturedProductsTest
      include NavigableTest

      def featured_product_model
        @featured_product_model ||= create_category
      end

      def navigable_class
        Category
      end

      def test_valid?
        category = Category.new(product_ids: ['', nil, '1234'])
        category.valid?

        assert_equal(['1234'], category.product_ids)
      end

      def test_unique_client_ids
        category_1 = create_category
        category_2 = create_category
        category_3 = create_category(client_id: nil)
        category_4 = create_category(client_id: nil)
        category_5 = create_category(client_id: 'test')
        category_6 = Category.new(client_id: 'test')

        assert_nil(category_1.client_id)
        assert_nil(category_2.client_id)
        assert_nil(category_3.client_id)
        assert_nil(category_4.client_id)
        assert_equal('test', category_5.client_id)
        refute(category_6.valid?)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

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