Sha256: 1cb7ad735500a3eae356afc8d1c4dc6ab6a0f487c8eea2ff8e9710910f413481

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module Refinery
  describe MetaHelper, type: :helper do

    describe '#canonical_id' do
      context "when page doesn't exist" do
        let(:page) { nil }

        it 'returns nothing' do
          expect(helper.canonical_id(page)).to be_nil
        end
      end

      context 'when page exists' do
        let(:page) { Page.new slug: 'testing' }

        it "returns the page's canonical slug with '-page' appended" do
          expect(helper.canonical_id(page)).to eq(page.canonical_slug << '-page')
        end
      end
    end

    describe '#view_template_class' do
      context "when page doesn't exist" do
        let(:page) { nil }

        it 'returns nothing' do
          expect(helper.view_template_class(page)).to be_nil
        end
      end

      context 'when page exists' do
        let(:page) { Page.new slug: 'testing', view_template: 'home' }

        it "returns the page's view_template with 'template-' prepended" do
          expect(helper.view_template_class(page)).to eq('template-' << page.view_template)
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-core-4.0.3 spec/helpers/refinery/meta_helper_spec.rb
refinerycms-core-4.0.2 spec/helpers/refinery/meta_helper_spec.rb
refinerycms-core-4.0.1 spec/helpers/refinery/meta_helper_spec.rb
refinerycms-core-3.0.6 spec/helpers/refinery/meta_helper_spec.rb
refinerycms-core-4.0.0 spec/helpers/refinery/meta_helper_spec.rb
refinerycms-core-3.0.5 spec/helpers/refinery/meta_helper_spec.rb