diff options
author | David Yip <yipdw@member.fsf.org> | 2018-01-10 12:49:43 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-10 12:49:43 -0600 |
commit | 26f054253c5071d6d56d85f6bc185ae1fc677649 (patch) | |
tree | f099afd931c3c5f625c5fcf39d1d853cafcc9c56 /spec/controllers | |
parent | 095a00ef3d6ed5845e331dc1e2b78fd42d861dd6 (diff) | |
parent | 395e64e8580e8232b817b6278ea28a7c523bd6f7 (diff) |
Merge pull request #319 from glitch-soc/317-attempt-to-switch-flavors-raises-actioncontroller-parametermissing
Fix #317: Attempting to switch flavors raises ActionController::ParameterMissing
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/settings/flavours_controller_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/controllers/settings/flavours_controller_spec.rb b/spec/controllers/settings/flavours_controller_spec.rb new file mode 100644 index 000000000..f89bde1f9 --- /dev/null +++ b/spec/controllers/settings/flavours_controller_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true +require 'rails_helper' + +RSpec.describe Settings::FlavoursController, type: :controller do + let(:user) { Fabricate(:user) } + + before do + sign_in user, scope: :user + end + + describe 'PUT #update' do + describe 'without a user[setting_skin] parameter' do + it 'sets the selected flavour' do + put :update, params: { flavour: 'schnozzberry' } + + user.reload + + expect(user.setting_flavour).to eq 'schnozzberry' + end + end + + describe 'with a user[setting_skin] parameter' do + before do + put :update, params: { flavour: 'schnozzberry', user: { setting_skin: 'wallpaper' } } + + user.reload + end + + it 'sets the selected flavour' do + expect(user.setting_flavour).to eq 'schnozzberry' + end + + it 'sets the selected skin' do + expect(user.setting_skin).to eq 'wallpaper' + end + end + end +end |