diff --git a/app/controllers/settings/theme_controller.rb b/app/controllers/settings/theme_controller.rb index 1f3a252d..aeb789a5 100644 --- a/app/controllers/settings/theme_controller.rb +++ b/app/controllers/settings/theme_controller.rb @@ -3,23 +3,22 @@ class Settings::ThemeController < ApplicationController before_action :authenticate_user! - def edit - end + def edit; end def update - update_attributes = params.require(:theme).permit([ - :primary_color, :primary_text, - :danger_color, :danger_text, - :success_color, :success_text, - :warning_color, :warning_text, - :info_color, :info_text, - :dark_color, :dark_text, - :light_color, :light_text, - :raised_background, :raised_accent, - :background_color, :body_text, - :muted_text, :input_color, - :input_text - ]) + update_attributes = params.require(:theme).permit(%i[ + primary_color primary_text + danger_color danger_text + success_color success_text + warning_color warning_text + info_color info_text + dark_color dark_text + light_color light_text + raised_background raised_accent + background_color body_text + muted_text input_color + input_text + ]) if current_user.theme.nil? current_user.theme = Theme.new update_attributes diff --git a/spec/controllers/settings/theme_controller_spec.rb b/spec/controllers/settings/theme_controller_spec.rb index b573fb78..f2e4418d 100644 --- a/spec/controllers/settings/theme_controller_spec.rb +++ b/spec/controllers/settings/theme_controller_spec.rb @@ -21,31 +21,31 @@ describe Settings::ThemeController, type: :controller do describe "#update" do let(:user) { FactoryBot.create(:user) } - let(:update_attributes) do - { + let(:update_attributes) do + { theme: { - primary_color: 6174129, - primary_text: 16777215, - danger_color: 14431557, - danger_text: 16777215, - success_color: 2664261, - success_text: 16777215, - warning_color: 16761095, - warning_text: 2697513, - info_color: 1548984, - info_text: 16777215, - dark_color: 3422784, - dark_text: 15658734, - light_color: 16316922, - light_text: 0, + primary_color: 6174129, + primary_text: 16777215, + danger_color: 14431557, + danger_text: 16777215, + success_color: 2664261, + success_text: 16777215, + warning_color: 16761095, + warning_text: 2697513, + info_color: 1548984, + info_text: 16777215, + dark_color: 3422784, + dark_text: 15658734, + light_color: 16316922, + light_text: 0, raised_background: 16777215, - raised_accent: 16250871, - background_color: 15789556, - body_text: 0, - muted_text: 7107965, - input_color: 15789556, - input_text: 0 - } + raised_accent: 16250871, + background_color: 15789556, + body_text: 0, + muted_text: 7107965, + input_color: 15789556, + input_text: 0 + } } end