Sha256: 4ba2f36615cfb1087a2bd6352c599bd8c826a2ad4f85c111fe74c374ec742332

Contents?: true

Size: 1.75 KB

Versions: 18

Compression:

Stored size: 1.75 KB

Contents

require 'spec_helper'

module Refinery
  module Pages
    describe ContentPagesHelper do
      let(:content_presenter) { double(ContentPresenter, :hide_sections => nil, :fetch_template_overrides => nil, :to_html => nil) }

      describe "when rendering content presenter" do
        it "asks to content presenter to hide sections if told to" do
          content_presenter.should_receive(:hide_sections).with(['foo', 'bar'])
          render_content_presenter(content_presenter, :hide_sections => ['foo', 'bar'])
        end

        it "attempts to fetch template overrides declared elsewhere via content_for" do
          content_presenter.should_receive(:fetch_template_overrides).and_yield(12)
          self.should_receive(:content_for).with(12)
          render_content_presenter(content_presenter)
        end

        it "outputs the html rendered by the content presenter" do
          content_presenter.should_receive(:to_html).and_return('foobar')
          render_content_presenter(content_presenter).should == 'foobar'
        end

        it "passes can_use_fallback option through to html rendering" do
          content_presenter.should_receive(:to_html).with(true)
          render_content_presenter(content_presenter, :can_use_fallback => true)
        end
      end

      describe "when rendering page" do
        let(:page) { double(Page) }

        it "builds a content page presenter and returns its html" do
          self.should_receive(:page_title).and_return('some title')
          Refinery::Pages::ContentPagePresenter.should_receive(:new).with(page, 'some title').and_return(content_presenter)
          content_presenter.should_receive(:to_html).and_return('barfoo')

          render_content_page(page).should == 'barfoo'
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
refinerycms-pages-2.1.5 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.1.4 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.1.3 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.1.2 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.1.1 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.1.0 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.10 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.9 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.8 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.7 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.6 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.5 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.4 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-page-menus-2.0.3 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.3 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.2 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.1 spec/helpers/refinery/pages/content_pages_helper_spec.rb
refinerycms-pages-2.0.0 spec/helpers/refinery/pages/content_pages_helper_spec.rb