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.

45 lines
1.3 KiB

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe UserSettingsDecorator do
  4. describe 'update' do
  5. let(:user) { Fabricate(:user) }
  6. let(:settings) { described_class.new(user) }
  7. it 'updates the user settings value for email notifications' do
  8. values = { 'notification_emails' => { 'follow' => '1' } }
  9. settings.update(values)
  10. expect(user.settings['notification_emails']['follow']).to eq true
  11. end
  12. it 'updates the user settings value for interactions' do
  13. values = { 'interactions' => { 'must_be_follower' => '0' } }
  14. settings.update(values)
  15. expect(user.settings['interactions']['must_be_follower']).to eq false
  16. end
  17. it 'updates the user settings value for privacy' do
  18. values = { 'setting_default_privacy' => 'public' }
  19. settings.update(values)
  20. expect(user.settings['default_privacy']).to eq 'public'
  21. end
  22. it 'updates the user settings value for boost modal' do
  23. values = { 'setting_boost_modal' => '1' }
  24. settings.update(values)
  25. expect(user.settings['boost_modal']).to eq true
  26. end
  27. it 'updates the user settings value for gif auto play' do
  28. values = { 'setting_auto_play_gif' => '0' }
  29. settings.update(values)
  30. expect(user.settings['auto_play_gif']).to eq false
  31. end
  32. end
  33. end