mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 18:51:07 +08:00
DEV: Refactor subclasses in ThemeSettingsManager
to individual files (#25605)
Why this change? One Ruby class per file improves readability
This commit is contained in:

committed by
GitHub

parent
7ce76143ac
commit
fb0e656cb7
@ -1,7 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "theme_settings_manager"
|
||||
|
||||
RSpec.describe ThemeSettingsManager do
|
||||
let!(:theme) { Fabricate(:theme) }
|
||||
|
||||
@ -12,8 +10,6 @@ RSpec.describe ThemeSettingsManager do
|
||||
theme.settings
|
||||
end
|
||||
|
||||
before { SiteSetting.experimental_objects_type_for_theme_settings = true }
|
||||
|
||||
describe "Enum" do
|
||||
it "only accepts values from its choices" do
|
||||
enum_setting = theme_settings[:enum_setting]
|
||||
@ -186,21 +182,4 @@ RSpec.describe ThemeSettingsManager do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe ThemeSettingsManager::Objects do
|
||||
it "can store a list of objects" do
|
||||
objects_setting = theme_settings[:valid_objects_setting]
|
||||
|
||||
expect(objects_setting.value).to eq(
|
||||
[{ "title" => "Some title", "description" => "Some description" }],
|
||||
)
|
||||
|
||||
objects_setting.value = [{ title: "title 1", description: "description 1" }]
|
||||
objects_setting = theme.reload.settings[:valid_objects_setting]
|
||||
|
||||
expect(objects_setting.value).to eq(
|
||||
[{ "title" => "title 1", "description" => "description 1" }],
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user