Sha256: 70b4c9e8f74a666ad7e807957cd5f41b849e73b0499ed95664a15a0f37314b47

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

module Alchemy
  describe BaseHelper do

    describe "#render_message" do
      context "if no argument is passed" do
        it "should render a div with an info icon and the given content" do
          expect(helper.render_message{ content_tag(:p, "my notice") }).to match(/<div class="info message"><span class="icon info"><\/span><p>my notice/)
        end
      end

      context "if an argument is passed" do
        it "should render the passed argument as the css classname for the icon container" do
          expect(helper.render_message(:error){ content_tag(:p, "my notice") }).to match(/<div class="error message"><span class="icon error">/)
        end
      end
    end

    describe '#page_or_find' do
      let(:page) { FactoryGirl.create(:public_page) }

      context "passing a page_layout string" do
        context "of a not existing page" do
          it "should return nil" do
            expect(helper.page_or_find('contact')).to be_nil
          end
        end

        context 'of an existing page' do
          it "should return the page object" do
            session[:alchemy_language_id] = page.language_id
            expect(helper.page_or_find(page.page_layout)).to eq(page)
          end
        end
      end

      context "passing a page object" do
        it "should return the given page object" do
          expect(helper.page_or_find(page)).to eq(page)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 spec/helpers/base_helper_spec.rb
lc_alchemy_cms-3.2.1 spec/helpers/base_helper_spec.rb
lc_alchemy_cms-3.2.0 spec/helpers/base_helper_spec.rb
alchemy_cms-3.2.0 spec/helpers/base_helper_spec.rb
alchemy_cms-3.2.0.rc1 spec/helpers/base_helper_spec.rb