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