]> cat aescling's git repositories - mastodon.git/blob - spec/controllers/settings/notifications_controller_spec.rb
Separate notifications preferences from general preferences (#4447)
[mastodon.git] / spec / controllers / settings / notifications_controller_spec.rb
1 require 'rails_helper'
2
3 describe Settings::NotificationsController do
4 render_views
5
6 let(:user) { Fabricate(:user) }
7
8 before do
9 sign_in user, scope: :user
10 end
11
12 describe 'GET #show' do
13 it 'returns http success' do
14 get :show
15 expect(response).to have_http_status(:success)
16 end
17 end
18
19 describe 'PUT #update' do
20 it 'updates notifications settings' do
21 user.settings['notification_emails'] = user.settings['notification_emails'].merge('follow' => false)
22 user.settings['interactions'] = user.settings['interactions'].merge('must_be_follower' => true)
23
24 put :update, params: {
25 user: {
26 notification_emails: { follow: '1' },
27 interactions: { must_be_follower: '0' },
28 }
29 }
30
31 expect(response).to redirect_to(settings_notifications_path)
32 user.reload
33 expect(user.settings['notification_emails']['follow']).to be true
34 expect(user.settings['interactions']['must_be_follower']).to be false
35 end
36 end
37 end
This page took 0.099032 seconds and 6 git commands to generate.