2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'User visits the notifications tab', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
|
|
|
visit(profile_notifications_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'changes the project notifications setting' do
|
|
|
|
expect(page).to have_content('Notifications')
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
first('#notifications-button').click
|
2017-09-10 17:25:29 +05:30
|
|
|
click_link('On mention')
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
expect(page).to have_selector('#notifications-button', text: 'On mention')
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2019-10-12 21:52:04 +05:30
|
|
|
|
|
|
|
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-09-10 17:25:29 +05:30
|
|
|
end
|