闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1009 B

  1. require 'rails_helper'
  2. describe Settings::NotificationsController do
  3. render_views
  4. let(:user) { Fabricate(:user) }
  5. before do
  6. sign_in user, scope: :user
  7. end
  8. describe 'GET #show' do
  9. it 'returns http success' do
  10. get :show
  11. expect(response).to have_http_status(:success)
  12. end
  13. end
  14. describe 'PUT #update' do
  15. it 'updates notifications settings' do
  16. user.settings['notification_emails'] = user.settings['notification_emails'].merge('follow' => false)
  17. user.settings['interactions'] = user.settings['interactions'].merge('must_be_follower' => true)
  18. put :update, params: {
  19. user: {
  20. notification_emails: { follow: '1' },
  21. interactions: { must_be_follower: '0' },
  22. }
  23. }
  24. expect(response).to redirect_to(settings_notifications_path)
  25. user.reload
  26. expect(user.settings['notification_emails']['follow']).to be true
  27. expect(user.settings['interactions']['must_be_follower']).to be false
  28. end
  29. end
  30. end