2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-22 02:28:11 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'User visits the notifications tab', :js do
|
2017-08-02 19:55:11 +00:00
|
|
|
let(:project) { create(:project) }
|
2017-06-22 02:28:11 +00:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2021-02-03 15:09:24 +00:00
|
|
|
stub_feature_flags(vue_notification_dropdown: false)
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
2017-06-22 02:28:11 +00:00
|
|
|
sign_in(user)
|
|
|
|
visit(profile_notifications_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'changes the project notifications setting' do
|
|
|
|
expect(page).to have_content('Notifications')
|
|
|
|
|
2017-08-03 05:13:46 +00:00
|
|
|
first('#notifications-button').click
|
2017-06-22 02:28:11 +00:00
|
|
|
click_link('On mention')
|
|
|
|
|
2018-03-16 16:51:03 +00:00
|
|
|
expect(page).to have_selector('#notifications-button', text: 'On mention')
|
2017-06-22 02:28:11 +00:00
|
|
|
end
|
2019-08-17 05:56:48 +00:00
|
|
|
|
|
|
|
context 'when project emails are disabled' do
|
|
|
|
let(:project) { create(:project, emails_disabled: true) }
|
|
|
|
|
|
|
|
it 'notification button is disabled' do
|
|
|
|
expect(page).to have_selector('.notifications-btn.disabled', visible: true)
|
|
|
|
end
|
|
|
|
end
|
2017-06-22 02:28:11 +00:00
|
|
|
end
|