2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-17 03:18:57 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'Profile > Notifications > User changes notified_of_own_activity setting', :js do
|
2017-03-17 03:18:57 +00:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(user)
|
2017-03-17 03:18:57 +00:00
|
|
|
end
|
|
|
|
|
2020-12-09 18:09:48 +00:00
|
|
|
it 'user opts into receiving notifications about their own activity' do
|
2017-03-17 03:18:57 +00:00
|
|
|
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
|
|
|
|
|
2020-12-09 18:09:48 +00:00
|
|
|
it 'user opts out of receiving notifications about their own activity' do
|
2017-03-17 03:18:57 +00:00
|
|
|
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
|