Commit 5a3b9c97 authored by Robert Speicher's avatar Robert Speicher

Account for `@project.description` being nil

parent b26eb782
...@@ -40,7 +40,7 @@ module PageLayoutHelper ...@@ -40,7 +40,7 @@ module PageLayoutHelper
# a view # a view
def page_description_default def page_description_default
if @project if @project
@project.description @project.description || brand_title
else else
brand_title brand_title
end end
......
...@@ -37,6 +37,14 @@ describe PageLayoutHelper do ...@@ -37,6 +37,14 @@ describe PageLayoutHelper do
expect(helper.page_description_default).to eq 'Project Description' expect(helper.page_description_default).to eq 'Project Description'
end 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 it 'falls back to brand_title' do
allow(helper).to receive(:brand_title).and_return('Brand Title') allow(helper).to receive(:brand_title).and_return('Brand Title')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment