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.15 test/services/workarea/set_navigable_test.rb
workarea-core-3.4.36 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.14 test/services/workarea/set_navigable_test.rb
workarea-core-3.4.35 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.13 test/services/workarea/set_navigable_test.rb
workarea-core-3.4.34 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.12 test/services/workarea/set_navigable_test.rb
workarea-core-3.4.33 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.11 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.10 test/services/workarea/set_navigable_test.rb
workarea-core-3.4.32 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.9 test/services/workarea/set_navigable_test.rb
workarea-core-3.4.31 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.8 test/services/workarea/set_navigable_test.rb
workarea-core-3.4.30 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.7 test/services/workarea/set_navigable_test.rb
workarea-core-3.4.29 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.6 test/services/workarea/set_navigable_test.rb
workarea-core-3.4.28 test/services/workarea/set_navigable_test.rb
workarea-core-3.5.5 test/services/workarea/set_navigable_test.rb