Sha256: 44ab6711683191f42813373e12da7a99e4d35c1b5161ddbb117541d5701e08ad

Contents?: true

Size: 1.44 KB

Versions: 17

Compression:

Stored size: 1.44 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
          helper.render_message{ content_tag(:p, "my notice") }.should 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
          helper.render_message(:error){ content_tag(:p, "my notice") }.should match(/<div class="error message"><span class="icon error">/)
        end
      end

    end

    describe "#configuration" do
      it "should return certain configuration options" do
        Config.stub!(:show).and_return({"some_option" => true})
        helper.configuration(:some_option).should == true
      end
    end

    describe "#multi_language?" do

      context "if more than one published language exists" do
        it "should return true" do
          Alchemy::Language.stub_chain(:published, :count).and_return(2)
          helper.multi_language?.should == true
        end
      end

      context "if less than two published languages exists" do
        it "should return false" do
          Alchemy::Language.stub_chain(:published, :count).and_return(1)
          helper.multi_language?.should == false
        end
      end

    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
alchemy_cms-2.5.3.1 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.3 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.2.2 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.2.1 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.2 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.1 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.0 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.0.rc3 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.0.b9 spec/helpers/base_helper_spec.rb
alchemy_cms-2.4.1 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.0.b5 spec/helpers/base_helper_spec.rb
alchemy_cms-2.5.0.b2 spec/helpers/base_helper_spec.rb
alchemy_cms-2.4.0 spec/helpers/base_helper_spec.rb
alchemy_cms-2.4.rc4 spec/helpers/base_helper_spec.rb
alchemy_cms-2.4.rc2 spec/helpers/base_helper_spec.rb
alchemy_cms-2.4.rc1 spec/helpers/base_helper_spec.rb
alchemy_cms-2.4.beta2 spec/helpers/base_helper_spec.rb