Use prefabricated users in bulk_invite_spec.rb

Use prefabricated users in bulk_invite_spec.rb

diff --git a/spec/jobs/bulk_invite_spec.rb b/spec/jobs/bulk_invite_spec.rb
index e6a7d0c..fb4e49d 100644
--- a/spec/jobs/bulk_invite_spec.rb
+++ b/spec/jobs/bulk_invite_spec.rb
@@ -21,22 +21,18 @@ describe Jobs::BulkInvite do
     end
 
     it 'raises an error when the filename is missing' do
-      user = Fabricate(:user)
-
       expect { Jobs::BulkInvite.new.execute(current_user_id: user.id) }
         .to raise_error(Discourse::InvalidParameters, /filename/)
     end
 
     it 'raises an error when current_user_id is not valid' do
-      user = Fabricate(:user)
-
       expect { Jobs::BulkInvite.new.execute(filename: filename) }
         .to raise_error(Discourse::InvalidParameters, /current_user_id/)
     end
 
     it 'creates the right invites' do
       described_class.new.execute(
-        current_user_id: Fabricate(:admin).id,
+        current_user_id: admin.id,
         filename: basename,
       )
 
@@ -56,7 +52,7 @@ describe Jobs::BulkInvite do
       group2.update!(automatic: true)
 
       described_class.new.execute(
-        current_user_id: Fabricate(:admin).id,
+        current_user_id: admin.id,
         filename: basename,
       )

GitHub sha: 54cfc489

1 Like