Commit 0cd315eb authored by charlie ablett's avatar charlie ablett

Replace owner with first_owner in EE specs

parent 99be341f
...@@ -25,7 +25,7 @@ RSpec.describe ProjectGroupLink do ...@@ -25,7 +25,7 @@ RSpec.describe ProjectGroupLink do
let!(:protected_tag) do let!(:protected_tag) do
ProtectedTags::CreateService.new( ProtectedTags::CreateService.new(
project, project,
project.owner, project.first_owner,
attributes_for( attributes_for(
:protected_tag, :protected_tag,
create_access_levels_attributes: [{ group_id: group.id }, { user_id: user.id }] create_access_levels_attributes: [{ group_id: group.id }, { user_id: user.id }]
...@@ -42,7 +42,7 @@ RSpec.describe ProjectGroupLink do ...@@ -42,7 +42,7 @@ RSpec.describe ProjectGroupLink do
let!(:protected_environment) do let!(:protected_environment) do
ProtectedEnvironments::CreateService.new( ProtectedEnvironments::CreateService.new(
container: project, container: project,
current_user: project.owner, current_user: project.first_owner,
params: attributes_for( params: attributes_for(
:protected_environment, :protected_environment,
deploy_access_levels_attributes: [{ group_id: group.id }, { user_id: user.id }] deploy_access_levels_attributes: [{ group_id: group.id }, { user_id: user.id }]
......
...@@ -113,7 +113,7 @@ RSpec.describe InstanceSecurityDashboard do ...@@ -113,7 +113,7 @@ RSpec.describe InstanceSecurityDashboard do
context 'when the user is not an auditor' do context 'when the user is not an auditor' do
context 'when the user is project owner' do context 'when the user is project owner' do
let(:user) { project1.owner } let(:user) { project1.first_owner }
it_behaves_like 'project permissions' do it_behaves_like 'project permissions' do
let(:expected_projects) { project1 } let(:expected_projects) { project1 }
......
...@@ -7,7 +7,7 @@ RSpec.describe ProductivityAnalytics do ...@@ -7,7 +7,7 @@ RSpec.describe ProductivityAnalytics do
subject(:analytics) { described_class.new(merge_requests: finder_mrs, sort: custom_sort) } subject(:analytics) { described_class.new(merge_requests: finder_mrs, sort: custom_sort) }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:finder_mrs) { ProductivityAnalyticsFinder.new(user, finder_options).execute } let(:finder_mrs) { ProductivityAnalyticsFinder.new(user, finder_options).execute }
let(:finder_options) { { state: 'merged' } } let(:finder_options) { { state: 'merged' } }
......
...@@ -2839,7 +2839,7 @@ RSpec.describe Project do ...@@ -2839,7 +2839,7 @@ RSpec.describe Project do
expect(project).to receive(:create_import_state) expect(project).to receive(:create_import_state)
project.update!(mirror: true, mirror_user: project.owner, import_url: 'http://foo.com') project.update!(mirror: true, mirror_user: project.first_owner, import_url: 'http://foo.com')
end end
end end
......
...@@ -291,7 +291,7 @@ RSpec.describe Security::OrchestrationPolicyConfiguration do ...@@ -291,7 +291,7 @@ RSpec.describe Security::OrchestrationPolicyConfiguration do
end end
describe '#policy_last_updated_by' do describe '#policy_last_updated_by' do
let(:commit) { create(:commit, author: security_policy_management_project.owner) } let(:commit) { create(:commit, author: security_policy_management_project.first_owner) }
subject(:policy_last_updated_by) { security_orchestration_policy_configuration.policy_last_updated_by } subject(:policy_last_updated_by) { security_orchestration_policy_configuration.policy_last_updated_by }
...@@ -301,7 +301,7 @@ RSpec.describe Security::OrchestrationPolicyConfiguration do ...@@ -301,7 +301,7 @@ RSpec.describe Security::OrchestrationPolicyConfiguration do
end end
context 'when last commit to policy file exists' do context 'when last commit to policy file exists' do
it { is_expected.to eq(security_policy_management_project.owner) } it { is_expected.to eq(security_policy_management_project.first_owner) }
end end
context 'when last commit to policy file does not exist' do context 'when last commit to policy file does not exist' do
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe BlobPresenter do RSpec.describe BlobPresenter do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner } let_it_be(:user) { project.first_owner }
let(:blob) { project.repository.blob_at('HEAD', 'files/ruby/regex.rb') } let(:blob) { project.repository.blob_at('HEAD', 'files/ruby/regex.rb') }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe API::API do RSpec.describe API::API do
describe 'logging', :aggregate_failures do describe 'logging', :aggregate_failures do
let_it_be(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
let_it_be(:user) { project.owner } let_it_be(:user) { project.first_owner }
context 'when the method is not allowed' do context 'when the method is not allowed' do
it 'logs the route and context metadata for the client' do it 'logs the route and context metadata for the client' do
......
...@@ -17,7 +17,7 @@ RSpec.describe API::Ci::Pipelines do ...@@ -17,7 +17,7 @@ RSpec.describe API::Ci::Pipelines do
describe 'DELETE /projects/:id/pipelines/:pipeline_id' do describe 'DELETE /projects/:id/pipelines/:pipeline_id' do
context 'authorized user' do context 'authorized user' do
let(:owner) { project.owner } let(:owner) { project.first_owner }
context 'when audit events is enabled' do context 'when audit events is enabled' do
before do before do
......
...@@ -8,7 +8,7 @@ RSpec.describe 'Set project compliance framework' do ...@@ -8,7 +8,7 @@ RSpec.describe 'Set project compliance framework' do
let_it_be(:namespace) { create(:namespace) } let_it_be(:namespace) { create(:namespace) }
let_it_be(:project) { create(:project, namespace: namespace) } let_it_be(:project) { create(:project, namespace: namespace) }
let_it_be(:framework) { create(:compliance_framework, namespace: namespace) } let_it_be(:framework) { create(:compliance_framework, namespace: namespace) }
let_it_be(:current_user) { project.owner } let_it_be(:current_user) { project.first_owner }
let(:variables) { { project_id: GitlabSchema.id_from_object(project).to_s, compliance_framework_id: GitlabSchema.id_from_object(framework).to_s } } let(:variables) { { project_id: GitlabSchema.id_from_object(project).to_s, compliance_framework_id: GitlabSchema.id_from_object(framework).to_s } }
......
...@@ -134,7 +134,7 @@ RSpec.describe API::StatusChecks do ...@@ -134,7 +134,7 @@ RSpec.describe API::StatusChecks do
it 'deletes the specified rule' do it 'deletes the specified rule' do
expect do expect do
delete api(single_object_url, project.owner) delete api(single_object_url, project.first_owner)
end.to change { MergeRequests::ExternalStatusCheck.count }.by(-1) end.to change { MergeRequests::ExternalStatusCheck.count }.by(-1)
end end
...@@ -152,7 +152,7 @@ RSpec.describe API::StatusChecks do ...@@ -152,7 +152,7 @@ RSpec.describe API::StatusChecks do
end end
it 'returns the correct status code' do it 'returns the correct status code' do
delete api(single_object_url, (project_owner ? project.owner : build(:user))) delete api(single_object_url, (project_owner ? project.first_owner : build(:user)))
expect(response).to have_gitlab_http_status(status) expect(response).to have_gitlab_http_status(status)
end end
...@@ -167,7 +167,7 @@ RSpec.describe API::StatusChecks do ...@@ -167,7 +167,7 @@ RSpec.describe API::StatusChecks do
end end
subject do subject do
post api("/projects/#{project.id}/external_status_checks", project.owner), params: attributes_for(:external_status_check) post api("/projects/#{project.id}/external_status_checks", project.first_owner), params: attributes_for(:external_status_check)
end end
it 'creates a new external approval rule' do it 'creates a new external approval rule' do
...@@ -182,7 +182,7 @@ RSpec.describe API::StatusChecks do ...@@ -182,7 +182,7 @@ RSpec.describe API::StatusChecks do
end end
subject do subject do
post api("/projects/#{project.id}/external_status_checks", project.owner), params: params post api("/projects/#{project.id}/external_status_checks", project.first_owner), params: params
end end
it 'returns expected status code' do it 'returns expected status code' do
...@@ -242,14 +242,14 @@ RSpec.describe API::StatusChecks do ...@@ -242,14 +242,14 @@ RSpec.describe API::StatusChecks do
end end
it 'responds with expected JSON', :aggregate_failures do it 'responds with expected JSON', :aggregate_failures do
get api(collection_url, project.owner) get api(collection_url, project.first_owner)
expect(json_response.size).to eq(2) expect(json_response.size).to eq(2)
expect(json_response.map { |r| r['name'] }).to contain_exactly('rule 1', 'rule 2') expect(json_response.map { |r| r['name'] }).to contain_exactly('rule 1', 'rule 2')
end end
it 'paginates correctly' do it 'paginates correctly' do
get api(collection_url, project.owner), params: { per_page: 1 } get api(collection_url, project.first_owner), params: { per_page: 1 }
expect_paginated_array_response([rule.id]) expect_paginated_array_response([rule.id])
end end
...@@ -268,7 +268,7 @@ RSpec.describe API::StatusChecks do ...@@ -268,7 +268,7 @@ RSpec.describe API::StatusChecks do
end end
it 'returns the correct status code' do it 'returns the correct status code' do
get api(collection_url, (project_owner ? project.owner : build(:user))) get api(collection_url, (project_owner ? project.first_owner : build(:user)))
expect(response).to have_gitlab_http_status(status) expect(response).to have_gitlab_http_status(status)
end end
...@@ -285,7 +285,7 @@ RSpec.describe API::StatusChecks do ...@@ -285,7 +285,7 @@ RSpec.describe API::StatusChecks do
end end
subject do subject do
put api(single_object_url, project.owner), params: params put api(single_object_url, project.first_owner), params: params
end end
it 'updates an approval rule' do it 'updates an approval rule' do
...@@ -306,7 +306,7 @@ RSpec.describe API::StatusChecks do ...@@ -306,7 +306,7 @@ RSpec.describe API::StatusChecks do
end end
subject do subject do
put api(single_object_url, project.owner), params: params put api(single_object_url, project.first_owner), params: params
end end
it 'is invalid' do it 'is invalid' do
...@@ -324,7 +324,7 @@ RSpec.describe API::StatusChecks do ...@@ -324,7 +324,7 @@ RSpec.describe API::StatusChecks do
end end
subject do subject do
put api(single_object_url, project.owner), params: params put api(single_object_url, project.first_owner), params: params
end end
it 'returns expected status code' do it 'returns expected status code' do
...@@ -362,7 +362,7 @@ RSpec.describe API::StatusChecks do ...@@ -362,7 +362,7 @@ RSpec.describe API::StatusChecks do
end end
it 'returns the correct status code' do it 'returns the correct status code' do
put api(single_object_url, (project_owner ? project.owner : build(:user))), params: attributes_for(:external_status_check) put api(single_object_url, (project_owner ? project.first_owner : build(:user))), params: attributes_for(:external_status_check)
expect(response).to have_gitlab_http_status(status) expect(response).to have_gitlab_http_status(status)
end end
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'view audit events' do RSpec.describe 'view audit events' do
describe 'GET /:namespace/:project/-/audit_events' do describe 'GET /:namespace/:project/-/audit_events' do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner } let_it_be(:user) { project.first_owner }
let_it_be(:audit_event) { create(:project_audit_event, entity_id: project.id) } let_it_be(:audit_event) { create(:project_audit_event, entity_id: project.id) }
before do before do
......
...@@ -8,7 +8,7 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -8,7 +8,7 @@ RSpec.describe Ci::CreatePipelineService do
subject(:execute) { service.execute(:push) } subject(:execute) { service.execute(:push) }
let(:project) { create(:project, :repository, name: 'website') } let(:project) { create(:project, :repository, name: 'website') }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:compliance_group) { create(:group, :private, name: "compliance") } let(:compliance_group) { create(:group, :private, name: "compliance") }
let(:compliance_project) { create(:project, :repository, namespace: compliance_group, name: "hippa") } let(:compliance_project) { create(:project, :repository, namespace: compliance_group, name: "hippa") }
let(:framework) { create(:compliance_framework, namespace_id: compliance_group.id, pipeline_configuration_full_path: ".compliance-gitlab-ci.yml@compliance/hippa") } let(:framework) { create(:compliance_framework, namespace_id: compliance_group.id, pipeline_configuration_full_path: ".compliance-gitlab-ci.yml@compliance/hippa") }
...@@ -37,7 +37,7 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -37,7 +37,7 @@ RSpec.describe Ci::CreatePipelineService do
context 'when user has access to compliance project' do context 'when user has access to compliance project' do
before do before do
compliance_project.add_maintainer(project.owner) compliance_project.add_maintainer(project.first_owner)
end end
it 'responds with success' do it 'responds with success' do
......
...@@ -6,7 +6,7 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -6,7 +6,7 @@ RSpec.describe Ci::CreatePipelineService do
subject(:execute) { service.execute(:push) } subject(:execute) { service.execute(:push) }
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner } let_it_be(:user) { project.first_owner }
let(:service) do let(:service) do
described_class.new(project, user, { ref: 'refs/heads/master' }) described_class.new(project, user, { ref: 'refs/heads/master' })
......
...@@ -6,7 +6,7 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -6,7 +6,7 @@ RSpec.describe Ci::CreatePipelineService do
let_it_be(:downstream_project) { create(:project, name: 'project', namespace: create(:namespace, name: 'some')) } let_it_be(:downstream_project) { create(:project, name: 'project', namespace: create(:namespace, name: 'some')) }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:service) { described_class.new(project, user, { ref: 'refs/heads/master' }) } let(:service) { described_class.new(project, user, { ref: 'refs/heads/master' }) }
let(:config) do let(:config) do
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Ci::CreatePipelineService, :sidekiq_inline do RSpec.describe Ci::CreatePipelineService, :sidekiq_inline do
let_it_be(:namespace) { create(:namespace, :with_used_build_minutes_limit) } let_it_be(:namespace) { create(:namespace, :with_used_build_minutes_limit) }
let_it_be(:project) { create(:project, :repository, namespace: namespace) } let_it_be(:project) { create(:project, :repository, namespace: namespace) }
let_it_be(:user) { project.owner } let_it_be(:user) { project.first_owner }
let_it_be(:instance_runner) { create(:ci_runner, :instance, :online) } let_it_be(:instance_runner) { create(:ci_runner, :instance, :online) }
let(:service) do let(:service) do
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe ::Ci::DestroyPipelineService do RSpec.describe ::Ci::DestroyPipelineService do
let(:project) { create(:project) } let(:project) { create(:project) }
let!(:pipeline) { create(:ci_pipeline, project: project) } let!(:pipeline) { create(:ci_pipeline, project: project) }
let(:user) { project.owner } let(:user) { project.first_owner }
subject { described_class.new(project, user).execute(pipeline) } subject { described_class.new(project, user).execute(pipeline) }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Ci::PipelineProcessing::AtomicProcessingService do RSpec.describe Ci::PipelineProcessing::AtomicProcessingService do
describe 'Pipeline Processing Service' do describe 'Pipeline Processing Service' do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:pipeline) do let(:pipeline) do
create(:ci_empty_pipeline, ref: 'master', project: project) create(:ci_empty_pipeline, ref: 'master', project: project)
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe ::Integrations::Test::ProjectService do RSpec.describe ::Integrations::Test::ProjectService do
describe '#execute' do describe '#execute' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:event) { nil } let(:event) { nil }
let(:sample_data) { { data: 'sample' } } let(:sample_data) { { data: 'sample' } }
let(:success_result) { { success: true, result: {} } } let(:success_result) { { success: true, result: {} } }
......
...@@ -17,7 +17,7 @@ RSpec.describe MergeRequests::BaseService do ...@@ -17,7 +17,7 @@ RSpec.describe MergeRequests::BaseService do
} }
end end
subject { MergeRequests::CreateService.new(project: project, current_user: project.owner, params: params) } subject { MergeRequests::CreateService.new(project: project, current_user: project.first_owner, params: params) }
let_it_be(:status_checks) { create_list(:external_status_check, 3, project: project) } let_it_be(:status_checks) { create_list(:external_status_check, 3, project: project) }
...@@ -38,7 +38,7 @@ RSpec.describe MergeRequests::BaseService do ...@@ -38,7 +38,7 @@ RSpec.describe MergeRequests::BaseService do
it 'calls ParamsFilteringService' do it 'calls ParamsFilteringService' do
expect(ApprovalRules::ParamsFilteringService).to receive(:new).with( expect(ApprovalRules::ParamsFilteringService).to receive(:new).with(
an_instance_of(MergeRequest), an_instance_of(MergeRequest),
project.owner, project.first_owner,
params params
).and_return(params_filtering_service) ).and_return(params_filtering_service)
expect(params_filtering_service).to receive(:execute).and_return(params) expect(params_filtering_service).to receive(:execute).and_return(params)
......
...@@ -56,7 +56,7 @@ RSpec.describe MergeRequests::CreateService do ...@@ -56,7 +56,7 @@ RSpec.describe MergeRequests::CreateService do
describe '#execute with blocking merge requests', :clean_gitlab_redis_shared_state do describe '#execute with blocking merge requests', :clean_gitlab_redis_shared_state do
let(:opts) { { title: 'Blocked MR', source_branch: 'feature', target_branch: 'master' } } let(:opts) { { title: 'Blocked MR', source_branch: 'feature', target_branch: 'master' } }
let(:user) { project.owner } let(:user) { project.first_owner }
it 'delegates to MergeRequests::UpdateBlocksService' do it 'delegates to MergeRequests::UpdateBlocksService' do
expect(MergeRequests::UpdateBlocksService) expect(MergeRequests::UpdateBlocksService)
......
...@@ -115,7 +115,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -115,7 +115,7 @@ RSpec.describe EE::NotificationService, :mailer do
let!(:project_member) { create(:project_member, :invited, project: project) } let!(:project_member) { create(:project_member, :invited, project: project) }
it 'sends email' do it 'sends email' do
expect(Notify).to receive(:mirror_was_hard_failed_email).with(project.id, project.owner.id).and_call_original expect(Notify).to receive(:mirror_was_hard_failed_email).with(project.id, project.first_owner.id).and_call_original
subject.mirror_was_hard_failed(project) subject.mirror_was_hard_failed(project)
end end
...@@ -134,7 +134,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -134,7 +134,7 @@ RSpec.describe EE::NotificationService, :mailer do
let(:project) { create(:project, :mirror, :import_hard_failed) } let(:project) { create(:project, :mirror, :import_hard_failed) }
it 'sends email' do it 'sends email' do
expect(Notify).to receive(:mirror_was_hard_failed_email).with(project.id, project.owner.id).and_call_original expect(Notify).to receive(:mirror_was_hard_failed_email).with(project.id, project.first_owner.id).and_call_original
subject.mirror_was_hard_failed(project) subject.mirror_was_hard_failed(project)
end end
...@@ -181,7 +181,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -181,7 +181,7 @@ RSpec.describe EE::NotificationService, :mailer do
project = create(:project, :mirror, :import_hard_failed) project = create(:project, :mirror, :import_hard_failed)
project.add_maintainer(user) project.add_maintainer(user)
expect(Notify).to receive(:mirror_was_hard_failed_email).with(project.id, project.owner.id).and_call_original expect(Notify).to receive(:mirror_was_hard_failed_email).with(project.id, project.first_owner.id).and_call_original
expect(Notify).to receive(:mirror_was_hard_failed_email).with(project.id, user.id).and_call_original expect(Notify).to receive(:mirror_was_hard_failed_email).with(project.id, user.id).and_call_original
subject.mirror_was_hard_failed(project) subject.mirror_was_hard_failed(project)
...@@ -239,7 +239,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -239,7 +239,7 @@ RSpec.describe EE::NotificationService, :mailer do
let!(:project_member) { create(:project_member, :invited, project: project) } let!(:project_member) { create(:project_member, :invited, project: project) }
it 'sends email' do it 'sends email' do
expect(Notify).to receive(:mirror_was_disabled_email).with(project.id, project.owner.id, deleted_username).and_call_original expect(Notify).to receive(:mirror_was_disabled_email).with(project.id, project.first_owner.id, deleted_username).and_call_original
subject.mirror_was_disabled(project, deleted_username) subject.mirror_was_disabled(project, deleted_username)
end end
...@@ -256,7 +256,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -256,7 +256,7 @@ RSpec.describe EE::NotificationService, :mailer do
context 'when user is owner' do context 'when user is owner' do
it 'sends email' do it 'sends email' do
expect(Notify).to receive(:mirror_was_disabled_email).with(project.id, project.owner.id, deleted_username).and_call_original expect(Notify).to receive(:mirror_was_disabled_email).with(project.id, project.first_owner.id, deleted_username).and_call_original
subject.mirror_was_disabled(project, deleted_username) subject.mirror_was_disabled(project, deleted_username)
end end
...@@ -302,7 +302,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -302,7 +302,7 @@ RSpec.describe EE::NotificationService, :mailer do
it 'sends email' do it 'sends email' do
project.add_maintainer(user) project.add_maintainer(user)
expect(Notify).to receive(:mirror_was_disabled_email).with(project.id, project.owner.id, deleted_username).and_call_original expect(Notify).to receive(:mirror_was_disabled_email).with(project.id, project.first_owner.id, deleted_username).and_call_original
expect(Notify).to receive(:mirror_was_disabled_email).with(project.id, user.id, deleted_username).and_call_original expect(Notify).to receive(:mirror_was_disabled_email).with(project.id, user.id, deleted_username).and_call_original
subject.mirror_was_disabled(project, deleted_username) subject.mirror_was_disabled(project, deleted_username)
...@@ -930,7 +930,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -930,7 +930,7 @@ RSpec.describe EE::NotificationService, :mailer do
let_it_be(:participant) { create(:incident_management_oncall_participant, rotation: rotation) } let_it_be(:participant) { create(:incident_management_oncall_participant, rotation: rotation) }
it 'sends an email to the owner and participants' do it 'sends an email to the owner and participants' do
expect(Notify).to receive(:user_removed_from_rotation_email).with(user, rotation, [schedule.project.owner]).once.and_call_original expect(Notify).to receive(:user_removed_from_rotation_email).with(user, rotation, [schedule.project.first_owner]).once.and_call_original
expect(Notify).to receive(:user_removed_from_rotation_email).with(user, rotation, [participant.user]).once.and_call_original expect(Notify).to receive(:user_removed_from_rotation_email).with(user, rotation, [participant.user]).once.and_call_original
subject.oncall_user_removed(rotation, user) subject.oncall_user_removed(rotation, user)
...@@ -949,14 +949,14 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -949,14 +949,14 @@ RSpec.describe EE::NotificationService, :mailer do
let!(:rule_2) { create(:incident_management_escalation_rule, :with_user, :resolved, project: project, user: user) } let!(:rule_2) { create(:incident_management_escalation_rule, :with_user, :resolved, project: project, user: user) }
it 'immediately sends an email to the project owner' do it 'immediately sends an email to the project owner' do
expect(Notify).to receive(:user_escalation_rule_deleted_email).with(user, project, rules, project.owner).once.and_call_original expect(Notify).to receive(:user_escalation_rule_deleted_email).with(user, project, rules, project.first_owner).once.and_call_original
expect(Notify).not_to receive(:user_escalation_rule_deleted_email).with(user, project, rules, user) expect(Notify).not_to receive(:user_escalation_rule_deleted_email).with(user, project, rules, user)
expect { subject.user_escalation_rule_deleted(project, user, rules) }.to change(ActionMailer::Base.deliveries, :size).by(1) expect { subject.user_escalation_rule_deleted(project, user, rules) }.to change(ActionMailer::Base.deliveries, :size).by(1)
end end
context 'when project owner is the removed user' do context 'when project owner is the removed user' do
let(:user) { project.owner } let(:user) { project.first_owner }
it 'does not send an email' do it 'does not send an email' do
expect(Notify).not_to receive(:user_escalation_rule_deleted_email) expect(Notify).not_to receive(:user_escalation_rule_deleted_email)
......
...@@ -8,7 +8,7 @@ RSpec.describe ProtectedBranches::CreateService do ...@@ -8,7 +8,7 @@ RSpec.describe ProtectedBranches::CreateService do
let(:source_project) { create(:project) } let(:source_project) { create(:project) }
let(:target_project) { fork_project(source_project, user, repository: true) } let(:target_project) { fork_project(source_project, user, repository: true) }
let(:user) { source_project.owner } let(:user) { source_project.first_owner }
let(:params) do let(:params) do
{ {
......
...@@ -6,7 +6,7 @@ RSpec.describe ProtectedBranches::DestroyService do ...@@ -6,7 +6,7 @@ RSpec.describe ProtectedBranches::DestroyService do
let(:protected_branch) { create(:protected_branch) } let(:protected_branch) { create(:protected_branch) }
let(:branch_name) { protected_branch.name } let(:branch_name) { protected_branch.name }
let(:project) { protected_branch.project } let(:project) { protected_branch.project }
let(:user) { project.owner } let(:user) { project.first_owner }
describe '#execute' do describe '#execute' do
subject(:service) { described_class.new(project, user) } subject(:service) { described_class.new(project, user) }
......
...@@ -6,7 +6,7 @@ RSpec.describe ProtectedBranches::UpdateService do ...@@ -6,7 +6,7 @@ RSpec.describe ProtectedBranches::UpdateService do
let(:branch_name) { 'feature' } let(:branch_name) { 'feature' }
let(:protected_branch) { create(:protected_branch, name: branch_name) } let(:protected_branch) { create(:protected_branch, name: branch_name) }
let(:project) { protected_branch.project } let(:project) { protected_branch.project }
let(:user) { project.owner } let(:user) { project.first_owner }
subject(:service) { described_class.new(project, user, params) } subject(:service) { described_class.new(project, user, params) }
......
...@@ -83,7 +83,7 @@ RSpec.describe Users::DestroyService do ...@@ -83,7 +83,7 @@ RSpec.describe Users::DestroyService do
context 'when user has escalation rules' do context 'when user has escalation rules' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:project_policy) { create(:incident_management_escalation_policy, project: project) } let(:project_policy) { create(:incident_management_escalation_policy, project: project) }
let!(:project_rule) { create(:incident_management_escalation_rule, :with_user, policy: project_policy, user: user) } let!(:project_rule) { create(:incident_management_escalation_rule, :with_user, policy: project_policy, user: user) }
......
...@@ -6,7 +6,7 @@ RSpec.describe ExternalStatusChecks::CreateService do ...@@ -6,7 +6,7 @@ RSpec.describe ExternalStatusChecks::CreateService do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:protected_branch) { create(:protected_branch, project: project) } let_it_be(:protected_branch) { create(:protected_branch, project: project) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:params) do let(:params) do
{ {
name: 'Test', name: 'Test',
......
...@@ -6,7 +6,7 @@ RSpec.describe ExternalStatusChecks::DestroyService do ...@@ -6,7 +6,7 @@ RSpec.describe ExternalStatusChecks::DestroyService do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:rule) { create(:external_status_check, project: project) } let_it_be(:rule) { create(:external_status_check, project: project) }
let(:current_user) { project.owner } let(:current_user) { project.first_owner }
subject { described_class.new(container: project, current_user: current_user).execute(rule) } subject { described_class.new(container: project, current_user: current_user).execute(rule) }
......
...@@ -7,7 +7,7 @@ RSpec.describe ExternalStatusChecks::UpdateService do ...@@ -7,7 +7,7 @@ RSpec.describe ExternalStatusChecks::UpdateService do
let_it_be(:check) { create(:external_status_check, project: project) } let_it_be(:check) { create(:external_status_check, project: project) }
let_it_be(:protected_branch) { create(:protected_branch, project: project) } let_it_be(:protected_branch) { create(:protected_branch, project: project) }
let(:current_user) { project.owner } let(:current_user) { project.first_owner }
let(:params) { { id: project.id, check_id: check.id, external_url: 'http://newvalue.com', name: 'new name', protected_branch_ids: [protected_branch.id] } } let(:params) { { id: project.id, check_id: check.id, external_url: 'http://newvalue.com', name: 'new name', protected_branch_ids: [protected_branch.id] } }
subject { described_class.new(container: project, current_user: current_user, params: params).execute } subject { described_class.new(container: project, current_user: current_user, params: params).execute }
......
...@@ -26,7 +26,7 @@ RSpec.describe MergeRequests::UpdateBlocksService do ...@@ -26,7 +26,7 @@ RSpec.describe MergeRequests::UpdateBlocksService do
describe '#execute' do describe '#execute' do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { merge_request.target_project.owner } let(:user) { merge_request.target_project.first_owner }
let(:mr_to_ignore) { create(:merge_request) } let(:mr_to_ignore) { create(:merge_request) }
let(:mr_to_add) { create(:merge_request) } let(:mr_to_add) { create(:merge_request) }
......
...@@ -24,7 +24,7 @@ RSpec.describe Projects::DestroyService do ...@@ -24,7 +24,7 @@ RSpec.describe Projects::DestroyService do
let(:max_capacity) { Gitlab::CurrentSettings.mirror_max_capacity } let(:max_capacity) { Gitlab::CurrentSettings.mirror_max_capacity }
let_it_be(:project_mirror) { create(:project, :mirror, :repository, :import_scheduled) } let_it_be(:project_mirror) { create(:project, :mirror, :repository, :import_scheduled) }
let(:result) { described_class.new(project_mirror, project_mirror.owner, {}).execute } let(:result) { described_class.new(project_mirror, project_mirror.first_owner, {}).execute }
before do before do
Gitlab::Mirror.increment_capacity(project_mirror.id) Gitlab::Mirror.increment_capacity(project_mirror.id)
......
...@@ -7,7 +7,7 @@ RSpec.describe Projects::UpdateMirrorService do ...@@ -7,7 +7,7 @@ RSpec.describe Projects::UpdateMirrorService do
create(:project, :repository, :mirror, import_url: Project::UNKNOWN_IMPORT_URL, only_mirror_protected_branches: false) create(:project, :repository, :mirror, import_url: Project::UNKNOWN_IMPORT_URL, only_mirror_protected_branches: false)
end end
subject(:service) { described_class.new(project, project.owner) } subject(:service) { described_class.new(project, project.first_owner) }
describe "#execute" do describe "#execute" do
context 'unlicensed' do context 'unlicensed' do
...@@ -121,7 +121,7 @@ RSpec.describe Projects::UpdateMirrorService do ...@@ -121,7 +121,7 @@ RSpec.describe Projects::UpdateMirrorService do
stub_fetch_mirror(project) stub_fetch_mirror(project)
expect(Git::TagPushService).to receive(:new) expect(Git::TagPushService).to receive(:new)
.with(project, project.owner, change: hash_including(ref: 'refs/tags/new-tag'), mirror_update: true) .with(project, project.first_owner, change: hash_including(ref: 'refs/tags/new-tag'), mirror_update: true)
.and_return(double(execute: true)) .and_return(double(execute: true))
service.execute service.execute
...@@ -326,7 +326,7 @@ RSpec.describe Projects::UpdateMirrorService do ...@@ -326,7 +326,7 @@ RSpec.describe Projects::UpdateMirrorService do
def create_file(repository) def create_file(repository)
repository.create_file( repository.create_file(
project.owner, project.first_owner,
'/newfile.txt', '/newfile.txt',
'hello', 'hello',
message: 'Add newfile.txt', message: 'Add newfile.txt',
......
...@@ -15,7 +15,7 @@ RSpec.describe Search::ProjectService do ...@@ -15,7 +15,7 @@ RSpec.describe Search::ProjectService do
it_behaves_like 'EE search service shared examples', ::Gitlab::ProjectSearchResults, ::Gitlab::Elastic::ProjectSearchResults do it_behaves_like 'EE search service shared examples', ::Gitlab::ProjectSearchResults, ::Gitlab::Elastic::ProjectSearchResults do
let_it_be(:scope) { create(:project) } let_it_be(:scope) { create(:project) }
let(:user) { scope.owner } let(:user) { scope.first_owner }
let(:service) { described_class.new(scope, user, params) } let(:service) { described_class.new(scope, user, params) }
end end
end end
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Security::SecurityOrchestrationPolicies::CreatePipelineService do RSpec.describe Security::SecurityOrchestrationPolicies::CreatePipelineService do
describe '#execute' do describe '#execute' do
let_it_be_with_reload(:project) { create(:project, :repository) } let_it_be_with_reload(:project) { create(:project, :repository) }
let_it_be(:current_user) { project.owner } let_it_be(:current_user) { project.first_owner }
let_it_be(:branch) { project.default_branch } let_it_be(:branch) { project.default_branch }
let(:action) { { scan: 'secret_detection' } } let(:action) { { scan: 'secret_detection' } }
......
...@@ -7,7 +7,7 @@ RSpec.describe Security::SecurityOrchestrationPolicies::PolicyCommitService do ...@@ -7,7 +7,7 @@ RSpec.describe Security::SecurityOrchestrationPolicies::PolicyCommitService do
describe '#execute' do describe '#execute' do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:current_user) { project.owner } let_it_be(:current_user) { project.first_owner }
let_it_be(:policy_management_project) { create(:project, :repository, creator: current_user) } let_it_be(:policy_management_project) { create(:project, :repository, creator: current_user) }
let_it_be(:policy_configuration) { create(:security_orchestration_policy_configuration, security_policy_management_project: policy_management_project, project: project) } let_it_be(:policy_configuration) { create(:security_orchestration_policy_configuration, security_policy_management_project: policy_management_project, project: project) }
......
...@@ -10,12 +10,12 @@ RSpec.describe Security::SecurityOrchestrationPolicies::ProcessScanResultPolicyS ...@@ -10,12 +10,12 @@ RSpec.describe Security::SecurityOrchestrationPolicies::ProcessScanResultPolicyS
let(:policy) { build(:scan_result_policy, name: 'Test Policy') } let(:policy) { build(:scan_result_policy, name: 'Test Policy') }
let(:policy_yaml) { Gitlab::Config::Loader::Yaml.new(policy.to_yaml).load! } let(:policy_yaml) { Gitlab::Config::Loader::Yaml.new(policy.to_yaml).load! }
let(:project) { policy_configuration.project } let(:project) { policy_configuration.project }
let(:approver) { project.owner } let(:approver) { project.first_owner }
let(:service) { described_class.new(policy_configuration: policy_configuration, policy: policy, policy_index: 0) } let(:service) { described_class.new(policy_configuration: policy_configuration, policy: policy, policy_index: 0) }
before do before do
group.add_maintainer(approver) group.add_maintainer(approver)
allow(policy_configuration).to receive(:policy_last_updated_by).and_return(project.owner) allow(policy_configuration).to receive(:policy_last_updated_by).and_return(project.first_owner)
end end
subject { service.execute } subject { service.execute }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Security::SecurityOrchestrationPolicies::ProjectCreateService do RSpec.describe Security::SecurityOrchestrationPolicies::ProjectCreateService do
describe '#execute' do describe '#execute' do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:current_user) { project.owner } let_it_be(:current_user) { project.first_owner }
subject(:service) { described_class.new(project: project, current_user: current_user) } subject(:service) { described_class.new(project: project, current_user: current_user) }
...@@ -33,7 +33,7 @@ RSpec.describe Security::SecurityOrchestrationPolicies::ProjectCreateService do ...@@ -33,7 +33,7 @@ RSpec.describe Security::SecurityOrchestrationPolicies::ProjectCreateService do
context 'when adding users to security policy project fails' do context 'when adding users to security policy project fails' do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:current_user) { project.owner } let_it_be(:current_user) { project.first_owner }
let_it_be(:maintainer) { create(:user) } let_it_be(:maintainer) { create(:user) }
before do before do
......
...@@ -766,7 +766,7 @@ RSpec.describe Security::StoreReportService, '#execute', :snowplow do ...@@ -766,7 +766,7 @@ RSpec.describe Security::StoreReportService, '#execute', :snowplow do
before do before do
stub_licensed_features(container_scanning: true, security_dashboard: true) stub_licensed_features(container_scanning: true, security_dashboard: true)
allow(pipeline).to receive(:user).and_return(project.owner) allow(pipeline).to receive(:user).and_return(project.first_owner)
end end
it 'populates finding location' do it 'populates finding location' do
......
...@@ -4,5 +4,5 @@ RSpec.shared_context 'orchestration policy context' do ...@@ -4,5 +4,5 @@ RSpec.shared_context 'orchestration policy context' do
let_it_be(:policy_last_updated_at) { Time.now } let_it_be(:policy_last_updated_at) { Time.now }
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:policy_management_project) { create(:project) } let_it_be(:policy_management_project) { create(:project) }
let_it_be(:user) { policy_management_project.owner } let_it_be(:user) { policy_management_project.first_owner }
end end
...@@ -4,7 +4,7 @@ RSpec.shared_examples 'status page quick actions' do ...@@ -4,7 +4,7 @@ RSpec.shared_examples 'status page quick actions' do
describe '/publish' do describe '/publish' do
let_it_be(:status_page_setting) { create(:status_page_setting, :enabled, project: project) } let_it_be(:status_page_setting) { create(:status_page_setting, :enabled, project: project) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
stub_licensed_features(status_page: true) stub_licensed_features(status_page: true)
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'layouts/nav/sidebar/_project' do RSpec.describe 'layouts/nav/sidebar/_project' do
let_it_be_with_refind(:project) { create(:project, :repository) } let_it_be_with_refind(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner } let_it_be(:user) { project.first_owner }
before do before do
assign(:project, project) assign(:project, project)
...@@ -63,7 +63,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do ...@@ -63,7 +63,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
describe 'Jira' do describe 'Jira' do
let_it_be_with_refind(:project) { create(:project, has_external_issue_tracker: true) } let_it_be_with_refind(:project) { create(:project, has_external_issue_tracker: true) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_user).and_return(user)
...@@ -100,7 +100,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do ...@@ -100,7 +100,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end end
describe 'Requirements' do describe 'Requirements' do
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
stub_licensed_features(requirements: true) stub_licensed_features(requirements: true)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe "projects/security/policies/index", type: :view do RSpec.describe "projects/security/policies/index", type: :view do
let(:user) { project.owner } let(:user) { project.first_owner }
let(:project) { create(:project) } let(:project) { create(:project) }
before do before do
......
...@@ -10,7 +10,7 @@ RSpec.describe 'shared/_mirror_status.html.haml' do ...@@ -10,7 +10,7 @@ RSpec.describe 'shared/_mirror_status.html.haml' do
before do before do
@project = project # for the view @project = project # for the view
sign_in(project.owner) sign_in(project.first_owner)
end end
context 'when mirror has not updated yet' do context 'when mirror has not updated yet' do
......
...@@ -9,7 +9,7 @@ RSpec.describe 'shared/mirror_update_button' do ...@@ -9,7 +9,7 @@ RSpec.describe 'shared/mirror_update_button' do
let(:import_state) { project.import_state } let(:import_state) { project.import_state }
let(:owner) { project.owner } let(:owner) { project.first_owner }
let(:developer) { create(:user).tap { |user| project.team.add_developer(user) } } let(:developer) { create(:user).tap { |user| project.team.add_developer(user) } }
let(:reporter) { create(:user).tap { |user| project.team.add_reporter(user) } } let(:reporter) { create(:user).tap { |user| project.team.add_reporter(user) } }
......
...@@ -11,7 +11,7 @@ RSpec.describe PostReceive do ...@@ -11,7 +11,7 @@ RSpec.describe PostReceive do
let(:base64_changes) { Base64.encode64(wrongly_encoded_changes) } let(:base64_changes) { Base64.encode64(wrongly_encoded_changes) }
let(:base64_changes_with_master) { Base64.encode64(changes_with_master) } let(:base64_changes_with_master) { Base64.encode64(changes_with_master) }
let(:gl_repository) { "project-#{project.id}" } let(:gl_repository) { "project-#{project.id}" }
let(:key) { create(:key, user: project.owner) } let(:key) { create(:key, user: project.first_owner) }
let(:key_id) { key.shell_id } let(:key_id) { key.shell_id }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
...@@ -55,7 +55,7 @@ RSpec.describe PostReceive do ...@@ -55,7 +55,7 @@ RSpec.describe PostReceive do
] ]
expect(::RepositoryPushAuditEventWorker).to receive(:perform_async) expect(::RepositoryPushAuditEventWorker).to receive(:perform_async)
.with(expected_changes, project.id, project.owner.id) .with(expected_changes, project.id, project.first_owner.id)
described_class.new.perform(gl_repository, key_id, base64_changes) described_class.new.perform(gl_repository, key_id, base64_changes)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment