DEV: Clear `ColorScheme.hex_cache` to avoid leaking state.
This commit is contained in:
parent
2acb885c72
commit
5ae4cbcf88
|
@ -1,6 +1,10 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe ColorSchemeColor do
|
describe ColorSchemeColor do
|
||||||
|
after do
|
||||||
|
ColorScheme.hex_cache.clear
|
||||||
|
end
|
||||||
|
|
||||||
def test_invalid_hex(hex)
|
def test_invalid_hex(hex)
|
||||||
c = described_class.new(hex: hex)
|
c = described_class.new(hex: hex)
|
||||||
expect(c).not_to be_valid
|
expect(c).not_to be_valid
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe ColorScheme do
|
describe ColorScheme do
|
||||||
|
after do
|
||||||
|
ColorScheme.hex_cache.clear
|
||||||
|
end
|
||||||
|
|
||||||
let(:valid_params) { { name: "Best Colors Evar", colors: valid_colors } }
|
let(:valid_params) { { name: "Best Colors Evar", colors: valid_colors } }
|
||||||
|
|
||||||
let(:valid_colors) { [
|
let(:valid_colors) { [
|
||||||
{ name: '$primary_background_color', hex: 'FFBB00' },
|
{ name: '$primary_background_color', hex: 'FFBB00' },
|
||||||
{ name: '$secondary_background_color', hex: '888888' }
|
{ name: '$secondary_background_color', hex: '888888' }
|
||||||
|
|
|
@ -1040,9 +1040,14 @@ describe Topic do
|
||||||
|
|
||||||
it "resets the topic archetype" do
|
it "resets the topic archetype" do
|
||||||
topic.expects(:add_moderator_post)
|
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(topic.archetype).to eq(Archetype.default)
|
||||||
|
expect(message.channel).to eq("/site/banner")
|
||||||
|
expect(message.data).to eq(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -134,7 +134,6 @@ RSpec.configure do |config|
|
||||||
|
|
||||||
unfreeze_time
|
unfreeze_time
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
ColorScheme.hex_cache.clear
|
|
||||||
|
|
||||||
raise if ActiveRecord::Base.connection_pool.stat[:busy] > 1
|
raise if ActiveRecord::Base.connection_pool.stat[:busy] > 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue