mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 11:44:39 +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
37
spec/lib/theme_settings_manager/objects_spec.rb
Normal file
37
spec/lib/theme_settings_manager/objects_spec.rb
Normal file
@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe ThemeSettingsManager::Objects do
|
||||
fab!(:theme)
|
||||
|
||||
before { SiteSetting.experimental_objects_type_for_theme_settings = true }
|
||||
|
||||
it "can store a list of objects" do
|
||||
objects_setting =
|
||||
described_class.new(
|
||||
"some_objects_setting",
|
||||
[{ "title" => "Some title", "description" => "Some description" }],
|
||||
theme,
|
||||
schema: {
|
||||
name: "Some Object",
|
||||
fields: {
|
||||
title: {
|
||||
type: "string",
|
||||
},
|
||||
description: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
expect(objects_setting.value).to eq(
|
||||
[{ "title" => "Some title", "description" => "Some description" }],
|
||||
)
|
||||
|
||||
objects_setting.value = [{ title: "title 1", description: "description 1" }]
|
||||
|
||||
expect(objects_setting.value).to eq(
|
||||
[{ "title" => "title 1", "description" => "description 1" }],
|
||||
)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user