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.

38 lines
908 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Settings::FlavoursController, type: :controller do
  4. let(:user) { Fabricate(:user) }
  5. before do
  6. sign_in user, scope: :user
  7. end
  8. describe 'PUT #update' do
  9. describe 'without a user[setting_skin] parameter' do
  10. it 'sets the selected flavour' do
  11. put :update, params: { flavour: 'schnozzberry' }
  12. user.reload
  13. expect(user.setting_flavour).to eq 'schnozzberry'
  14. end
  15. end
  16. describe 'with a user[setting_skin] parameter' do
  17. before do
  18. put :update, params: { flavour: 'schnozzberry', user: { setting_skin: 'wallpaper' } }
  19. user.reload
  20. end
  21. it 'sets the selected flavour' do
  22. expect(user.setting_flavour).to eq 'schnozzberry'
  23. end
  24. it 'sets the selected skin' do
  25. expect(user.setting_skin).to eq 'wallpaper'
  26. end
  27. end
  28. end
  29. end