PERF: Redis snapshotting during tests (#15260)

We can fake redis transactions so that `fab!` works for redis and PG
data, but it's too slow to be used indiscriminately. Instead, you can
opt into it with the `use_redis_snapshotting` helper.

Insofar as snapshotting allows us to `fab!` more things, it provides a
speedup.
This commit is contained in:
Daniel Waterworth
2021-12-10 14:25:26 -06:00
committed by GitHub
parent e42f33b6ba
commit 02245ce41f
5 changed files with 72 additions and 5 deletions

View File

@ -1756,11 +1756,13 @@ RSpec.describe TopicsController do
end
describe '#show' do
fab!(:private_topic) { Fabricate(:private_message_topic) }
let!(:topic) { Fabricate(:post).topic }
use_redis_snapshotting
let!(:p1) { Fabricate(:post, user: topic.user) }
let!(:p2) { Fabricate(:post, user: topic.user) }
fab!(:private_topic) { Fabricate(:private_message_topic) }
fab!(:topic) { Fabricate(:post).topic }
fab!(:p1) { Fabricate(:post, user: topic.user) }
fab!(:p2) { Fabricate(:post, user: topic.user) }
describe 'when topic is not allowed' do
it 'should return the right response' do