Sha256: 8afab839d42a8159eabc05e9bf3f331dc6ebba59ff8ad224d8247a0d790b244a

Contents?: true

Size: 1019 Bytes

Versions: 34

Compression:

Stored size: 1019 Bytes

Contents

require 'pageflow/global_config_api_test_helper'
require 'factory_bot_rails'

module Pageflow
  module RenderPageTestHelper
    def render_page(page_type_or_page, configuration = {})
      page, page_type =
        if page_type_or_page.is_a?(Page)
          [page_type_or_page, page_type_or_page.page_type]
        else
          [FactoryBot.create(:page, template: page_type_or_page.name, configuration: configuration),
           page_type_or_page]
        end

      revision = page.chapter.storyline.revision
      entry = PublishedEntry.new(revision.entry, revision)

      helper.extend(InfoBoxHelper)
      helper.extend(BackgroundImageHelper)
      helper.extend(EntryJsonSeedHelper)
      helper.extend(PageBackgroundAssetHelper)
      helper.extend(PagesHelper)
      helper.extend(VideoFilesHelper)

      page_type.view_helpers.each do |page_type_helper|
        helper.extend(page_type_helper)
      end

      assign(:entry, entry)

      helper.render_page_template(page, entry: entry)
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
pageflow-support-14.5.2 pageflow/render_page_test_helper.rb
pageflow-support-15.2.2 pageflow/render_page_test_helper.rb
pageflow-support-15.2.1 pageflow/render_page_test_helper.rb
pageflow-support-15.2.0 pageflow/render_page_test_helper.rb
pageflow-support-15.1.2 pageflow/render_page_test_helper.rb
pageflow-support-15.1.1 pageflow/render_page_test_helper.rb
pageflow-support-15.1.0 pageflow/render_page_test_helper.rb
pageflow-support-15.1.0.rc0 pageflow/render_page_test_helper.rb
pageflow-support-15.1.0.beta6 pageflow/render_page_test_helper.rb
pageflow-support-15.1.0.beta5 pageflow/render_page_test_helper.rb
pageflow-support-15.1.0.beta4 pageflow/render_page_test_helper.rb
pageflow-support-15.1.0.beta2 pageflow/render_page_test_helper.rb
pageflow-support-15.1.0.beta1 pageflow/render_page_test_helper.rb
pageflow-support-15.0.2 pageflow/render_page_test_helper.rb
pageflow-support-15.0.1 pageflow/render_page_test_helper.rb
pageflow-support-15.0.0 pageflow/render_page_test_helper.rb
pageflow-support-14.5.1 pageflow/render_page_test_helper.rb
pageflow-support-14.5.0 pageflow/render_page_test_helper.rb
pageflow-support-15.0.0.rc2 pageflow/render_page_test_helper.rb
pageflow-support-15.0.0.rc1 pageflow/render_page_test_helper.rb