Sha256: 773bf289118013963fb340cf963946b7d0173edb2461451fd1fe728b67c7ea98

Contents?: true

Size: 1.25 KB

Versions: 62

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

module Workarea
  class SetNavigableTest < TestCase
    def taxon
      @taxon ||= Navigation::Taxon.new
    end

    def test_navigable_class
      service = SetNavigable.new(
        taxon,
        navigable_type: 'category',
        navigable_id: '1234',
        new_navigable_type: 'page',
        new_navigable_name: ''
      )

      assert_equal(Catalog::Category, service.navigable_class)

      service = SetNavigable.new(
        taxon,
        navigable_type: 'page',
        navigable_id: '',
        new_navigable_type: 'page',
        new_navigable_name: 'Test Page'
      )

      assert_equal(Content::Page, service.navigable_class)

      service = SetNavigable.new(
        taxon,
        navigable_type: 'product',
        navigable_id: '',
        new_navigable_type: 'product',
        new_navigable_name: 'Test Product'
      )

      assert_equal(Catalog::Product, service.navigable_class)
    end

    def test_remove_navigable
      page = create_page
      taxon = create_taxon(navigable: page)
      service = SetNavigable.new(taxon, navigable_type: 'page', navigable_id: '')

      assert_equal(page, taxon.navigable)
      assert_nil(service.navigable)

      service.set

      assert_nil(taxon.navigable)
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

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