mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 10:17:15 +08:00
DEV: Prefabrication (test optimization) (#7414)
* Introduced fab!, a helper that creates database state for a group It's almost identical to let_it_be, except: 1. It creates a new object for each test by default, 2. You can disable it using PREFABRICATION=0
This commit is contained in:
@ -89,9 +89,9 @@ describe UserUpdater do
|
||||
end
|
||||
|
||||
describe '#update' do
|
||||
let(:category) { Fabricate(:category) }
|
||||
let(:tag) { Fabricate(:tag) }
|
||||
let(:tag2) { Fabricate(:tag) }
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
fab!(:tag) { Fabricate(:tag) }
|
||||
fab!(:tag2) { Fabricate(:tag) }
|
||||
|
||||
it 'saves user' do
|
||||
user = Fabricate(:user, name: 'Billy Bob')
|
||||
@ -274,8 +274,8 @@ describe UserUpdater do
|
||||
end
|
||||
|
||||
context 'title is from a badge' do
|
||||
let(:user) { Fabricate(:user, title: 'Emperor') }
|
||||
let(:badge) { Fabricate(:badge, name: 'Minion') }
|
||||
fab!(:user) { Fabricate(:user, title: 'Emperor') }
|
||||
fab!(:badge) { Fabricate(:badge, name: 'Minion') }
|
||||
|
||||
context 'badge can be used as a title' do
|
||||
before do
|
||||
|
Reference in New Issue
Block a user