discourse/spec/lib/theme_flag_modifier_spec.rb
David Taylor c9dab6fd08
DEV: Automatically require 'rails_helper' in all specs (#16077)
It's very easy to forget to add `require 'rails_helper'` at the top of every core/plugin spec file, and omissions can cause some very confusing/sporadic errors.

By setting this flag in `.rspec`, we can remove the need for `require 'rails_helper'` entirely.
2022-03-01 17:50:50 +00:00

16 lines
565 B
Ruby

# frozen_string_literal: true
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_id: theme.id })
tmh = ThemeModifierHelper.new(request: request)
expect(tmh.serialize_topic_excerpts).to eq(true)
end
end