Sha256: c12f688d8d19a4e869ea899c79c228c3071a4789b1f85f109ab8187b0fbf7808

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

module Enki
  describe PageTitleHelper do
    include PageTitleHelper

    before do
      config = double('config')
      config.stub!('[]').with(:title).and_return('Blog Title')
      Enki.stub!(:config).and_return(config)
    end

    describe '#posts_title with no tag' do
      it 'is the site title' do
        posts_title(nil).should == "Blog Title"
      end
    end

    describe '#posts_title with tag' do
      it 'is the titlelized tag name plus the site title' do
        posts_title("ruby").should == "Ruby - Blog Title"
      end
    end

    describe '#post_title' do
      it 'is the post title plus the site title' do
        posts_title("My Post").should == "My Post - Blog Title"
      end
    end

    describe '#archives_title' do
      it 'is "Archives" plus the site title' do
        archives_title.should == "Archives - Blog Title"
      end
    end

    describe '#page_title' do
      it 'is the page title plus the site title' do
        posts_title("My Page").should == "My Page - Blog Title"
      end
    end

    describe '#html_title' do
      it 'uses the given string when present' do
        html_title('a').should == "a"  
      end

      it 'defaults to the configured title if nothing is supplied' do
        html_title('' ).should == "Blog Title"  
        html_title(nil).should == "Blog Title"  
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enki-engine-0.0.5 spec/helpers/page_title_helper_spec.rb
enki-engine-0.0.4 spec/helpers/page_title_helper_spec.rb
enki-engine-0.0.3 spec/helpers/page_title_helper_spec.rb
enki-engine-0.0.2 spec/helpers/page_title_helper_spec.rb