Commit ef688d84 authored by charlie ablett's avatar charlie ablett

Replace owner with first_owner in various specs

parent 99be341f
......@@ -11,7 +11,7 @@ RSpec.describe BuildDetailsEntity do
describe '#as_json' do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, :failed, pipeline: pipeline) }
let(:request) { double('request', project: project) }
......
......@@ -7,7 +7,7 @@ RSpec.describe Ci::Lint::ResultSerializer, :aggregate_failures do
let(:result) do
Gitlab::Ci::Lint
.new(project: project, current_user: project.owner)
.new(project: project, current_user: project.first_owner)
.validate(yaml_content, dry_run: false)
end
......@@ -64,7 +64,7 @@ RSpec.describe Ci::Lint::ResultSerializer, :aggregate_failures do
context 'when dry run is enabled' do
let(:result) do
Gitlab::Ci::Lint
.new(project: project, current_user: project.owner)
.new(project: project, current_user: project.first_owner)
.validate(yaml_content, dry_run: true)
end
......
......@@ -142,7 +142,7 @@ RSpec.describe DiffFileBaseEntity do
end
context 'when source_project and target_project are different' do
let(:target_project) { fork_project(source_project, source_project.owner, repository: true) }
let(:target_project) { fork_project(source_project, source_project.first_owner, repository: true) }
it 'returns the merge_request ide route with the target_project as param' do
expect(entity[:ide_edit_path]).to eq("#{expected_merge_request_path}?target_project=#{ERB::Util.url_encode(target_project.full_path)}")
......
......@@ -7,7 +7,7 @@ RSpec.describe RunnerEntity do
let(:runner) { create(:ci_runner, :project, projects: [project]) }
let(:entity) { described_class.new(runner, request: request, current_user: user) }
let(:request) { double('request') }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
allow(request).to receive(:current_user).and_return(user)
......
......@@ -31,7 +31,7 @@ RSpec.describe TriggerVariableEntity do
end
context 'when user is owner' do
let(:user) { project.owner }
let(:user) { project.first_owner }
it 'exposes the variable value' do
expect(subject).to include(:value)
......
......@@ -129,7 +129,7 @@ eos
commit_message: 'Add new content')
Files::CreateService.new(
project,
project.owner,
project.first_owner,
commit_message: commit_message,
start_branch: start_branch,
branch_name: branch_name,
......
......@@ -11,7 +11,7 @@ RSpec.shared_context 'package details setup' do
let(:package_files) { all_graphql_fields_for('PackageFile') }
let(:dependency_links) { all_graphql_fields_for('PackageDependencyLink') }
let(:pipelines) { all_graphql_fields_for('Pipeline', max_depth: 1) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:package_details) { graphql_data_at(:package) }
let(:metadata_response) { graphql_data_at(:package, :metadata) }
let(:first_file) { package.package_files.find { |f| global_id_of(f) == first_file_response['id'] } }
......
......@@ -62,7 +62,7 @@ RSpec.shared_examples 'a creatable merge request' do
end
it 'updates the branches when selecting a new target project', :js do
target_project_member = target_project.owner
target_project_member = target_project.first_owner
::Branches::CreateService.new(target_project, target_project_member)
.execute('a-brand-new-branch-to-test', 'master')
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.shared_examples 'ZenTao menu with CE version' do
let(:project) { create(:project, has_external_issue_tracker: true) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project) }
let(:zentao_integration) { create(:zentao_integration, project: project) }
......
......@@ -115,14 +115,14 @@ RSpec.shared_examples 'UpdateProjectStatistics' do |with_counter_attribute|
expect(ProjectStatistics)
.not_to receive(:increment_statistic)
expect(Projects::DestroyService.new(project, project.owner).execute).to eq(true)
expect(Projects::DestroyService.new(project, project.first_owner).execute).to eq(true)
end
it 'does not schedule a namespace statistics worker' do
expect(Namespaces::ScheduleAggregationWorker)
.not_to receive(:perform_async)
expect(Projects::DestroyService.new(project, project.owner).execute).to eq(true)
expect(Projects::DestroyService.new(project, project.first_owner).execute).to eq(true)
end
end
end
......
......@@ -190,7 +190,7 @@ RSpec.shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
if parent_type == 'projects'
context 'by a project owner' do
let(:user) { project.owner }
let(:user) { project.first_owner }
it 'sets the creation time on the new note' do
post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user), params: params
......
......@@ -344,9 +344,9 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do
shared_examples 'includes repositories in all repository storages' do
specify :aggregate_failures do
project_a = create(:project, :repository)
project_snippet_a = create(:project_snippet, :repository, project: project_a, author: project_a.owner)
project_snippet_a = create(:project_snippet, :repository, project: project_a, author: project_a.first_owner)
project_b = create(:project, :repository, repository_storage: second_storage_name)
project_snippet_b = create(:project_snippet, :repository, project: project_b, author: project_b.owner)
project_snippet_b = create(:project_snippet, :repository, project: project_b, author: project_b.first_owner)
project_snippet_b.snippet_repository.update!(shard: project_b.project_repository.shard)
create(:wiki_page, container: project_a)
create(:design, :with_file, issue: create(:issue, project: project_a))
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'layouts/nav/sidebar/_project' do
let_it_be_with_reload(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:current_ref) { 'master' }
before do
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Ci::ExternalPullRequests::CreatePipelineWorker do
let_it_be(:project) { create(:project, :auto_devops, :repository) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }
let_it_be(:external_pull_request) do
branch = project.repository.branches.last
create(:external_pull_request, project: project, source_branch: branch.name, source_sha: branch.target)
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe CleanupContainerRepositoryWorker, :clean_gitlab_redis_shared_state do
let(:repository) { create(:container_repository) }
let(:project) { repository.project }
let(:user) { project.owner }
let(:user) { project.first_owner }
subject { described_class.new }
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe DeleteContainerRepositoryWorker do
let(:registry) { create(:container_repository) }
let(:project) { registry.project }
let(:user) { project.owner }
let(:user) { project.first_owner }
subject { described_class.new }
......
......@@ -13,11 +13,11 @@ RSpec.describe DeleteMergedBranchesWorker do
expect(instance).to receive(:execute).and_return(true)
end
worker.perform(project.id, project.owner.id)
worker.perform(project.id, project.first_owner.id)
end
it "returns false when project was not found" do
expect(worker.perform('unknown', project.owner.id)).to be_falsy
expect(worker.perform('unknown', project.first_owner.id)).to be_falsy
end
end
end
......@@ -15,7 +15,7 @@ RSpec.describe PostReceive do
let(:wrongly_encoded_changes) { changes.encode("ISO-8859-1").force_encoding("UTF-8") }
let(:base64_changes) { Base64.encode64(wrongly_encoded_changes) }
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(:project) do
......@@ -47,7 +47,7 @@ RSpec.describe PostReceive do
context 'with PersonalSnippet' do
let(:gl_repository) { "snippet-#{snippet.id}" }
let(:snippet) { create(:personal_snippet, author: project.owner) }
let(:snippet) { create(:personal_snippet, author: project.first_owner) }
it 'does not log an error' do
expect(Gitlab::GitLogger).not_to receive(:error)
......@@ -60,7 +60,7 @@ RSpec.describe PostReceive do
context 'with ProjectSnippet' do
let(:gl_repository) { "snippet-#{snippet.id}" }
let(:snippet) { create(:snippet, type: 'ProjectSnippet', project: nil, author: project.owner) }
let(:snippet) { create(:snippet, type: 'ProjectSnippet', project: nil, author: project.first_owner) }
it 'returns false and logs an error' do
expect(Gitlab::GitLogger).to receive(:error).with("POST-RECEIVE: #{error_message}")
......@@ -74,7 +74,7 @@ RSpec.describe PostReceive do
let(:empty_project) { create(:project, :empty_repo) }
before do
allow_next(Gitlab::GitPostReceive).to receive(:identify).and_return(empty_project.owner)
allow_next(Gitlab::GitPostReceive).to receive(:identify).and_return(empty_project.first_owner)
# Need to mock here so we can expect calls on project
allow(Gitlab::GlRepository).to receive(:parse).and_return([empty_project, empty_project, Gitlab::GlRepository::PROJECT])
end
......@@ -128,7 +128,7 @@ RSpec.describe PostReceive do
let(:push_service) { double(execute: true) }
before do
allow_next(Gitlab::GitPostReceive).to receive(:identify).and_return(project.owner)
allow_next(Gitlab::GitPostReceive).to receive(:identify).and_return(project.first_owner)
allow(Gitlab::GlRepository).to receive(:parse).and_return([project, project, Gitlab::GlRepository::PROJECT])
end
......@@ -381,7 +381,7 @@ RSpec.describe PostReceive do
allow(Project).to receive(:find_by).and_return(project)
expect_next(MergeRequests::PushedBranchesService).to receive(:execute).and_return(%w(tést))
expect(UpdateMergeRequestsWorker).to receive(:perform_async).with(project.id, project.owner.id, any_args)
expect(UpdateMergeRequestsWorker).to receive(:perform_async).with(project.id, project.first_owner.id, any_args)
perform
end
......@@ -461,13 +461,13 @@ RSpec.describe PostReceive do
end
context 'with PersonalSnippet' do
let!(:snippet) { create(:personal_snippet, :repository, author: project.owner) }
let!(:snippet) { create(:personal_snippet, :repository, author: project.first_owner) }
it_behaves_like 'snippet changes actions'
end
context 'with ProjectSnippet' do
let!(:snippet) { create(:project_snippet, :repository, project: project, author: project.owner) }
let!(:snippet) { create(:project_snippet, :repository, project: project, author: project.first_owner) }
it_behaves_like 'snippet changes actions'
end
......
......@@ -14,7 +14,7 @@ RSpec.describe ProjectDestroyWorker do
describe '#perform' do
it 'deletes the project' do
subject.perform(project.id, project.owner.id, {})
subject.perform(project.id, project.first_owner.id, {})
expect(Project.all).not_to include(project)
expect(Dir.exist?(path)).to be_falsey
......@@ -22,7 +22,7 @@ RSpec.describe ProjectDestroyWorker do
it 'does not raise error when project could not be found' do
expect do
subject.perform(-1, project.owner.id, {})
subject.perform(-1, project.first_owner.id, {})
end.not_to raise_error
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