Sha256: 583f0ea8587a1cc0dc63c1d04f770379fd1a041149d5098ac474bc21d2361ed0

Contents?: true

Size: 1.6 KB

Versions: 6

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'
require 'pageflow/lint'

Pageflow::Lint.page_type(Pageflow::ExternalLinks.page_type)

module Pageflow
  module ExternalLinks
    describe 'built in video page type', type: :helper do
      include RenderPageTestHelper

      it 'renders links to referenced sites' do
        revision = FactoryBot.create(:revision, :published)
        Site.create!(revision: revision,
                     perma_id: 10,
                     url: 'https://example.com',
                     title: 'Example')

        page = FactoryBot.create(:page,
                                 template: 'external_links',
                                 revision: revision,
                                 configuration: {
                                   linked_external_site_perma_ids: [10]
                                 })

        html = render_page(page)

        expect(html).to have_selector('.link-title', text: 'Example')
      end

      it 'can handle sites with missing url' do
        revision = FactoryBot.create(:revision, :published)
        Site.create!(revision: revision,
                     perma_id: 10,
                     url: nil,
                     title: 'Example')

        page = FactoryBot.create(:page,
                                 template: 'external_links',
                                 revision: revision,
                                 configuration: {
                                   linked_external_site_perma_ids: [10]
                                 })

        html = render_page(page)

        expect(html).to have_selector('.link-title', text: 'Example')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pageflow-external-links-2.6.0 spec/integration/page_type_spec.rb
pageflow-external-links-2.5.0 spec/integration/page_type_spec.rb
pageflow-external-links-2.4.1 spec/integration/page_type_spec.rb
pageflow-external-links-2.4.0 spec/integration/page_type_spec.rb
pageflow-external-links-2.3.0 spec/integration/page_type_spec.rb
pageflow-external-links-2.2.1 spec/integration/page_type_spec.rb