2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-21 22:28:11 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
describe 'User visits the notifications tab', :js do
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project) }
|
2017-06-21 22:28:11 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-06-21 22:28:11 -04: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 01:13:46 -04:00
|
|
|
first('#notifications-button').click
|
2017-06-21 22:28:11 -04:00
|
|
|
click_link('On mention')
|
|
|
|
|
2018-03-16 12:51:03 -04:00
|
|
|
expect(page).to have_selector('#notifications-button', text: 'On mention')
|
2017-06-21 22:28:11 -04:00
|
|
|
end
|
2019-08-17 01:56:48 -04: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-21 22:28:11 -04:00
|
|
|
end
|