Account for @project.description being nil

This commit is contained in:
Robert Speicher 2015-12-23 17:14:18 -05:00
parent b26eb782f5
commit 5a3b9c97e3
2 changed files with 9 additions and 1 deletions

View file

@ -40,7 +40,7 @@ module PageLayoutHelper
# a view
def page_description_default
if @project
@project.description
@project.description || brand_title
else
brand_title
end

View file

@ -37,6 +37,14 @@ describe PageLayoutHelper do
expect(helper.page_description_default).to eq 'Project Description'
end
it 'uses brand_title when Project description is nil' do
project = double(description: nil)
helper.instance_variable_set(:@project, project)
expect(helper).to receive(:brand_title).and_return('Brand Title')
expect(helper.page_description_default).to eq 'Brand Title'
end
it 'falls back to brand_title' do
allow(helper).to receive(:brand_title).and_return('Brand Title')