diff --git a/spec/features/menu_items/top_menu_item_spec.rb b/spec/features/menu_items/top_menu_item_spec.rb index e25d4c3e8705..99ed9849a026 100644 --- a/spec/features/menu_items/top_menu_item_spec.rb +++ b/spec/features/menu_items/top_menu_item_spec.rb @@ -67,7 +67,7 @@ def click_link_in_open_menu(title) end describe "Modules" do - let!(:top_menu) { find("[title=#{I18n.t('label_modules')}]") } + let(:top_menu) { find("[title=#{I18n.t('label_modules')}]") } shared_let(:menu_link_item) { Struct.new(:label, :path) } @@ -138,6 +138,14 @@ def click_link_in_open_menu(title) context "as an anonymous user" do let(:user) { create(:anonymous) } + context "when login_required", with_settings: { login_required: true } do + let(:open_menu) { false } + + it "redirects to login" do + expect(page).to have_current_path /login/ + end + end + context "when not login_required", with_settings: { login_required: false } do it "displays only projects, activity and news" do has_menu_items? project_item, activity_item, news_item