factories: cleanup Administrateur, Instructeur and Expert factories

This changes:

- avoids relying on application code to create mock objects,
- allows to build Administrateur or Instructeurs without saving them.
This commit is contained in:
Pierre de La Morinerie 2021-10-25 13:50:48 +00:00
parent 0ff95df221
commit a2b91c8ec6
9 changed files with 17 additions and 16 deletions

View file

@ -61,7 +61,7 @@ describe Manager::UsersController, type: :controller do
context 'and the old account belongs to an instructeur, expert and administrateur' do
let!(:instructeur) { create(:instructeur, user: user) }
let!(:expert) { create(:expert, user: user) }
let!(:administrateur) { create(:administrateur, user: user) }
let!(:administrateur) { create(:administrateur, user: user, instructeur: instructeur) }
it 'transfers instructeur account' do
subject

View file

@ -40,7 +40,7 @@ describe WebhookController, type: :controller do
context 'when there are an associated Instructeur and Administrateur' do
let!(:instructeur) { create(:instructeur, user: user) }
let!(:admin) { create(:administrateur, user: user) }
let!(:admin) { create(:administrateur, user: user, instructeur: instructeur) }
it 'returns a link to the Instructeur profile in the Manager' do
expect(payload).to have_key('html')