FIX: Multisite DB was leaving old data in test mode

This commit introduces a new helper to enable transactional fixtures
when testing multisite. This would show up as tests that passed the
first time then failed the second time due to stale data being leftover.
This commit is contained in:
Robin Ward
2019-01-09 15:13:02 -05:00
parent dec8e5879a
commit 9ba8bfb1aa
5 changed files with 40 additions and 30 deletions

View File

@ -1,8 +1,6 @@
require 'rails_helper'
RSpec.describe 'Multisite SiteSettings', type: :multisite do
let(:conn) { RailsMultisite::ConnectionManagement }
def cache(name, namespace: true)
DistributedCache.new(name, namespace: namespace)
end
@ -15,7 +13,7 @@ RSpec.describe 'Multisite SiteSettings', type: :multisite do
expect(cache1.hash).to eq('default' => true)
conn.with_connection('second') do
test_multisite_connection('second') do
message = MessageBus.track_publish(DistributedCache::Manager::CHANNEL_NAME) do
cache1['second'] = true
end.first