discourse/spec/lib/system_themes_manager_spec.rb
Krzysztof Kotlarek 2ee1c6d7d4
FIX: enforce system themes to be enabled (#33643)
Ensure that the system themes are always enabled.
2025-07-16 14:30:08 +08:00

22 lines
855 B
Ruby

# frozen_string_literal: true
RSpec.describe SystemThemesManager do
it "is idempotent" do
Theme.delete_all
expect { SystemThemesManager.sync! }.to change { Theme.system.count }.by(2)
expect { SystemThemesManager.sync! }.not_to change { Theme.count }
expect(Theme.horizon_theme.color_scheme.user_selectable).to be true
expect(
Theme.horizon_theme.color_schemes.where(name: "Horizon Dark").first.user_selectable,
).to be true
expect(Theme.horizon_theme.color_schemes.where(user_selectable: true).count).to eq(2)
expect(Theme.horizon_theme.color_schemes.where(user_selectable: false).count).to eq(10)
end
it "renables themes" do
SystemThemesManager.sync!
Theme.horizon_theme.update_column(:enabled, false)
SystemThemesManager.sync!
expect(Theme.horizon_theme.reload.enabled).to be true
end
end