A platform for community discussion. Free, open, simple.
# frozen_string_literal: true
RSpec.describe "When ActiveRecord is preventing writes" do
it "does not return an error when a theme field needs baking" do
theme_field =
Fabricate(
:theme_field,
type_id: ThemeField.types[:html],
target_id: Theme.targets[:common],
name: "head_tag",
value: <<~HTML,
<script>
console.log('foo');
</script>
HTML
)
SiteSetting.default_theme_id = theme_field.theme_id
ActiveRecord::Base.connected_to(role: ActiveRecord.writing_role, prevent_writes: true) do
get "/latest"
expect(request.env[:resolved_theme_id]).to eq(theme_field.theme_id)
expect(response.status).to eq(200)
end
end
end