discourse/spec/lib/theme_flag_modifier_spec.rb
David Taylor d1474e94a1
FEATURE: Allow themes to specify modifiers in their about.json file (#9097)
There are three modifiers:
- serialize_topic_excerpts (boolean)
- csp_extensions (array of strings)
- svg_icons (array of strings)

When multiple themes are active, the values will be combined. The combination method varies based on the setting. CSP/SVG arrays will be combined. serialize_topic_excerpts will use `Enumerable#any`.
2020-03-11 13:30:45 +00:00

18 lines
592 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe ThemeModifierHelper do
fab!(:theme) { Fabricate(:theme).tap { |t| t.theme_modifier_set.update!(serialize_topic_excerpts: true) } }
it "defines a getter for modifiers" do
tmh = ThemeModifierHelper.new(theme_ids: [theme.id])
expect(tmh.serialize_topic_excerpts).to eq(true)
end
it "can extract theme ids from a request object" do
request = Rack::Request.new({ resolved_theme_ids: [theme.id] })
tmh = ThemeModifierHelper.new(request: request)
expect(tmh.serialize_topic_excerpts).to eq(true)
end
end