diff --git a/app/views/shared/_admin_login_items.html.erb b/app/views/shared/_admin_login_items.html.erb index e268def4b..1d22679c5 100644 --- a/app/views/shared/_admin_login_items.html.erb +++ b/app/views/shared/_admin_login_items.html.erb @@ -6,10 +6,10 @@ <% end %> - <% if current_user.moderator? %> + <% if current_user.moderator? || current_user.administrator? %>
  • <%= link_to t("layouts.header.moderation"), moderation_root_path %>
  • <% end %> <% end %> - \ No newline at end of file + diff --git a/spec/features/moderation_spec.rb b/spec/features/moderation_spec.rb index cd3052f70..78df5e56f 100644 --- a/spec/features/moderation_spec.rb +++ b/spec/features/moderation_spec.rb @@ -5,6 +5,9 @@ feature 'Admin' do scenario 'Access as regular user is not authorized' do login_as(user) + visit root_path + + expect(page).to_not have_link("Moderation") visit moderation_root_path expect(current_path).to eq(root_path) @@ -15,7 +18,10 @@ feature 'Admin' do create(:moderator, user: user) login_as(user) - visit moderation_root_path + visit root_path + + expect(page).to have_link("Moderation") + click_on "Moderation" expect(current_path).to eq(moderation_root_path) expect(page).to_not have_content "not authorized" @@ -25,7 +31,10 @@ feature 'Admin' do create(:administrator, user: user) login_as(user) - visit moderation_root_path + visit root_path + + expect(page).to have_link("Moderation") + click_on "Moderation" expect(current_path).to eq(moderation_root_path) expect(page).to_not have_content "not authorized"