require 'spec_helper' module Landable describe PageDecorator do let(:page_decorator) { Landable::PageDecorator.new(page) } describe '#title' do let(:page) { create :page, title: 'title' } it 'lists the title' do page_decorator.title.should eq '
" } it 'lists the head_tags seperated by a new line' do page_decorator.head_content.should eq "
" page_decorator.head_content.should be_html_safe end context 'nil' do let(:page) { create :page, head_content: nil } it 'returns nil' do page_decorator.head_content.should be_nil end end end describe '#meta_tags' do let(:page) { create :page, meta_tags: { content: 'robots', keyword: 'p2p' } } it 'lists the meta_tags seperated by a new line' do page_decorator.meta_tags.should eq %(\n) page_decorator.meta_tags.should be_html_safe end context 'nil' do let(:page) { create :page, meta_tags: nil } it 'returns nil' do page_decorator.meta_tags.should be_nil end end context 'string' do let(:page) { create :page, meta_tags: 'I should be a hash!' } it 'returns nil' do page_decorator.meta_tags.should be_nil end end end end end