diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 9d5849eeec159e5e5b919b3add1f2ee8cd0cbc42..2dfca8bcfce8838888aa5821db07b819590f0597 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -208,7 +208,7 @@ describe Ci::Build, :models do
     end
 
     it 'expects to have retried builds instead the original ones' do
-      project.team << [user, :developer]
+      project.add_developer(user)
 
       retried_rspec = Ci::Build.retry(rspec_test, user)
 
@@ -817,7 +817,7 @@ describe Ci::Build, :models do
     subject { build.other_actions }
 
     before do
-      project.team << [user, :developer]
+      project.add_developer(user)
     end
 
     it 'returns other actions' do
@@ -865,7 +865,7 @@ describe Ci::Build, :models do
     let(:build) { create(:ci_build, :manual, pipeline: pipeline) }
 
     before do
-      project.team << [user, :developer]
+      project.add_developer(user)
     end
 
     context 'when build is manual' do
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 45c710b2381ffe03556027df68ae647e87cf765c..10c2bfbb4000ee0b6d6d98e42448c1725dc63be3 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -563,7 +563,7 @@ describe Ci::Pipeline, models: true do
     context 'on failure and build retry' do
       before do
         build.drop
-        project.team << [user, :developer]
+        project.add_developer(user)
 
         Ci::Build.retry(build, user)
       end
@@ -776,7 +776,7 @@ describe Ci::Pipeline, models: true do
     let(:latest_status) { pipeline.statuses.latest.pluck(:status) }
 
     before do
-      project.team << [user, :developer]
+      project.add_developer(user)
     end
 
     context 'when there is a failed build and failed external status' do
diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb
index 823808ccce1f536c5fe2e1fd8f105e7c7e943b54..ef2ddc4b1d782391542eb16551b6baecbe9df2f9 100644
--- a/spec/services/ci/process_pipeline_service_spec.rb
+++ b/spec/services/ci/process_pipeline_service_spec.rb
@@ -9,7 +9,7 @@ describe Ci::ProcessPipelineService, :services do
   end
 
   before do
-    project.team << [user, :developer]
+    project.add_developer(user)
   end
 
   describe '#execute' do
diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb
index 97c28ea50e065fec444c6c2740057a6993f9a6c2..b7e0308f033b5faee6ff0b336f0d654e4d93e594 100644
--- a/spec/services/ci/retry_build_service_spec.rb
+++ b/spec/services/ci/retry_build_service_spec.rb
@@ -15,7 +15,7 @@ describe Ci::RetryBuildService, :services do
 
     context 'when user has ability to execute build' do
       before do
-        project.team << [user, :developer]
+        project.add_developer(user)
       end
 
       it 'creates a new build that represents the old one' do
@@ -59,7 +59,7 @@ describe Ci::RetryBuildService, :services do
 
     context 'when user has ability to execute build' do
       before do
-        project.team << [user, :developer]
+        project.add_developer(user)
       end
 
       it 'creates a new build that represents the old one' do
diff --git a/spec/services/create_deployment_service_spec.rb b/spec/services/create_deployment_service_spec.rb
index 50679408dca634877f978a25732ff12d6a9ab35e..6fb4d517115f0bc6b793df52386e21c0edc06a5c 100644
--- a/spec/services/create_deployment_service_spec.rb
+++ b/spec/services/create_deployment_service_spec.rb
@@ -235,7 +235,7 @@ describe CreateDeploymentService, services: true do
       context 'when build is retried' do
         it_behaves_like 'does create environment and deployment' do
           before do
-            project.team << [user, :developer]
+            project.add_developer(user)
           end
 
           let(:deployable) { Ci::Build.retry(build, user) }