discourse/spec/lib/theme_settings_manager/objects_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
952 B
Ruby
Raw Normal View History

# 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