Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 1cb0397

Browse files
committed
resolve issues mention by codeclimate and hound
1 parent edb9f39 commit 1cb0397

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

app/controllers/manage/configs_controller.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ def update
1919
value = false if value == "false"
2020
if @config.var.end_with?("_asset") && !value.start_with?('http://', 'https://')
2121
redirect_to manage_configs_path, notice: "Config \"#{key}\" was not changed"
22-
else
23-
if @config.value != value
24-
@config.value = value
25-
@config.save
26-
redirect_to manage_configs_path, notice: "Config \"#{key}\" has been updated."
27-
else
28-
redirect_to manage_configs_path, notice: "Config \"#{key}\" was not changed"
29-
end
22+
elsif @config.value != value
23+
@config.value = value
24+
@config.save
25+
redirect_to manage_configs_path, notice: "Config \"#{key}\" has been updated."
26+
else
27+
redirect_to manage_configs_path, notice: "Config \"#{key}\" was not changed"
3028
end
3129
end
3230

test/controllers/manage/configs_controller_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ class Manage::ConfigsControllerTest < ActionController::TestCase
117117

118118
should "update logo_asset with a url" do
119119
HackathonConfig["logo_asset"] = ''
120-
patch :update, params: {id: "logo_asset", hackathon_config: { logo_asset: "https://picsum.photos/200" } }
120+
patch :update, params: { id: "logo_asset", hackathon_config: { logo_asset: "https://picsum.photos/200" } }
121121
assert_equal "https://picsum.photos/200", HackathonConfig["logo_asset"]
122122
end
123123

124-
should "update logo_asset with an asset that is not URL based" do
124+
should "update logo_asset with an asset that is not URL based" do
125125
HackathonConfig["logo_asset"] = ''
126-
patch :update, params: {id: "logo_asset", hackathon_config: { logo_asset: "test" } }
126+
patch :update, params: { id: "logo_asset", hackathon_config: { logo_asset: "test" } }
127127
assert_equal '', HackathonConfig["logo_asset"]
128128
end
129129

0 commit comments

Comments
 (0)