summaryrefslogtreecommitdiff
path: root/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb
blob: f618bc330eae914ea8d57b26da982f87c96f7456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'spec_helper'

describe 'Profile > Notifications > User changes notified_of_own_activity setting', :js do
  let(:user) { create(:user) }

  before do
    sign_in(user)
  end

  it 'User opts into receiving notifications about their own activity' do
    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

  it 'User opts out of receiving notifications about their own activity' do
    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