Account for @project.description
being nil
This commit is contained in:
parent
b26eb782f5
commit
5a3b9c97e3
2 changed files with 9 additions and 1 deletions
|
@ -40,7 +40,7 @@ module PageLayoutHelper
|
|||
# a view
|
||||
def page_description_default
|
||||
if @project
|
||||
@project.description
|
||||
@project.description || brand_title
|
||||
else
|
||||
brand_title
|
||||
end
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
Loading…
Reference in a new issue