DEV: Clear `ColorScheme.hex_cache` to avoid leaking state.

This commit is contained in:
Guo Xiang Tan 2018-10-15 11:15:31 +08:00
parent 2acb885c72
commit 5ae4cbcf88
4 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,10 @@
require 'rails_helper'
describe ColorSchemeColor do
after do
ColorScheme.hex_cache.clear
end
def test_invalid_hex(hex)
c = described_class.new(hex: hex)
expect(c).not_to be_valid

View File

@ -1,8 +1,12 @@
require 'rails_helper'
describe ColorScheme do
after do
ColorScheme.hex_cache.clear
end
let(:valid_params) { { name: "Best Colors Evar", colors: valid_colors } }
let(:valid_colors) { [
{ name: '$primary_background_color', hex: 'FFBB00' },
{ name: '$secondary_background_color', hex: '888888' }

View File

@ -1040,9 +1040,14 @@ describe Topic do
it "resets the topic archetype" do
topic.expects(:add_moderator_post)
MessageBus.expects(:publish).with("/site/banner", nil)
topic.remove_banner!(user)
message = MessageBus.track_publish do
topic.remove_banner!(user)
end.first
expect(topic.archetype).to eq(Archetype.default)
expect(message.channel).to eq("/site/banner")
expect(message.data).to eq(nil)
end
end

View File

@ -134,7 +134,6 @@ RSpec.configure do |config|
unfreeze_time
ActionMailer::Base.deliveries.clear
ColorScheme.hex_cache.clear
raise if ActiveRecord::Base.connection_pool.stat[:busy] > 1
end