diff --git a/app/views/relationable/_related_content.html.erb b/app/views/relationable/_related_content.html.erb index 19435fec2..a034fd14f 100644 --- a/app/views/relationable/_related_content.html.erb +++ b/app/views/relationable/_related_content.html.erb @@ -13,6 +13,8 @@ <%= render 'relationable/form', relationable: relationable %> - <%= render 'relationable/related_list', relationable: relationable %> + <% if @related_contents.present? %> + <%= render 'relationable/related_list', relationable: relationable %> + <% end %> diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 36d5015b5..51fdc3f79 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -159,6 +159,13 @@ feature 'Proposals' do end end + scenario 'related contents list is not rendered if there are no relations' do + proposal = create(:proposal) + + visit proposal_path(proposal) + expect(page).to_not have_css("#related-content-list") + end + scenario 'related contents can be added' do proposal1 = create(:proposal) proposal2 = create(:proposal)