2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Profile > Notifications > User changes notified_of_own_activity setting', :js do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'User opts into receiving notifications about their own activity' do
|
2017-08-17 22:00:37 +05:30
|
|
|
visit profile_notifications_path
|
|
|
|
|
|
|
|
expect(page).not_to have_checked_field('user[notified_of_own_activity]')
|
|
|
|
|
|
|
|
check 'user[notified_of_own_activity]'
|
|
|
|
|
|
|
|
expect(page).to have_content('Notification settings saved')
|
|
|
|
expect(page).to have_checked_field('user[notified_of_own_activity]')
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'User opts out of receiving notifications about their own activity' do
|
2017-08-17 22:00:37 +05:30
|
|
|
user.update!(notified_of_own_activity: true)
|
|
|
|
visit profile_notifications_path
|
|
|
|
|
|
|
|
expect(page).to have_checked_field('user[notified_of_own_activity]')
|
|
|
|
|
|
|
|
uncheck 'user[notified_of_own_activity]'
|
|
|
|
|
|
|
|
expect(page).to have_content('Notification settings saved')
|
|
|
|
expect(page).not_to have_checked_field('user[notified_of_own_activity]')
|
|
|
|
end
|
|
|
|
end
|