2020-03-11 21:30:45 +08:00
|
|
|
# frozen_string_literal: true
|
2022-07-28 10:27:38 +08:00
|
|
|
RSpec.describe ThemeModifierHelper do
|
2020-03-11 21:30:45 +08:00
|
|
|
fab!(:theme) do
|
|
|
|
Fabricate(:theme).tap { |t| t.theme_modifier_set.update!(serialize_topic_excerpts: true) }
|
2023-01-09 19:18:21 +08:00
|
|
|
end
|
2020-03-11 21:30:45 +08:00
|
|
|
|
|
|
|
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
|
2021-06-15 14:57:17 +08:00
|
|
|
request = Rack::Request.new({ resolved_theme_id: theme.id })
|
2020-03-11 21:30:45 +08:00
|
|
|
tmh = ThemeModifierHelper.new(request: request)
|
|
|
|
expect(tmh.serialize_topic_excerpts).to eq(true)
|
|
|
|
end
|
|
|
|
end
|