mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 18:43:44 +08:00
fb0e656cb7
Why this change? One Ruby class per file improves readability
38 lines
952 B
Ruby
38 lines
952 B
Ruby
# 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
|