Sha256: 2bbe5466406b489ca1f475982bee58b901bc8742c214ac82ea85e78df1039c9e

Contents?: true

Size: 957 Bytes

Versions: 62

Compression:

Stored size: 957 Bytes

Contents

require 'test_helper'

module Workarea
  class Metadata
    class ContentPageTest < TestCase
      setup :set_page_and_metadata

      def set_page_and_metadata
        @page = create_page(name: 'Foo')
        @content = Content.for(@page)
        @metadata = ContentPage.new(@content)
      end

      def test_defaults_to_page_name
        assert_equal('Foo', @metadata.title)
      end

      def test_includes_parent_taxon_if_available
        category = create_category(name: 'Bar')
        taxon = create_taxon(name: 'Bar', navigable: category)
        create_taxon(name: 'Foo', parent: taxon, navigable: @page)

        assert_equal('Foo - Bar', @metadata.title)
      end

      def test_defaults_to_text_extracted_from_content_blocks
        @content.blocks.create!(
          type: 'html',
          data: { html: '<p>Lorem ipsum dolor</p>' }
        )

        assert_equal('Lorem ipsum dolor', @metadata.description)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

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