Skip to content

Commit

Permalink
gitlab: Merge branch '350603-cablett-project-owner-specs-8' into 'mas…
Browse files Browse the repository at this point in the history
…ter'

Commit: 53c494bbf50e730388d8c52a375892894fa15854
  • Loading branch information
Robert May authored and sourcegraph-bot committed Jan 24, 2022
1 parent 795164a commit 0725594
Show file tree
Hide file tree
Showing 57 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion gitlab/spec/lib/api/entities/basic_project_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RSpec.describe API::Entities::BasicProjectDetails do
let_it_be(:project) { create(:project) }

let(:current_user) { project.owner }
let(:current_user) { project.first_owner }

subject(:output) { described_class.new(project, current_user: current_user).as_json }

Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/api/helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def app
describe '#find_project!' do
let_it_be(:project) { create(:project) }

let(:user) { project.owner}
let(:user) { project.first_owner}

before do
allow(subject).to receive(:current_user).and_return(user)
Expand Down
6 changes: 3 additions & 3 deletions gitlab/spec/lib/backup/gitaly_backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
create(:wiki_page, container: project)
create(:design, :with_file, issue: create(:issue, project: project))
project_snippet = create(:project_snippet, :repository, project: project)
personal_snippet = create(:personal_snippet, :repository, author: project.owner)
personal_snippet = create(:personal_snippet, :repository, author: project.first_owner)

expect(Open3).to receive(:popen2).with(expected_env, anything, 'create', '-path', anything).and_call_original

Expand Down Expand Up @@ -122,8 +122,8 @@

context 'restore' do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.owner) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.first_owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.first_owner) }

def copy_bundle_to_backup_path(bundle_name, destination)
FileUtils.mkdir_p(File.join(Gitlab.config.backup.path, 'repositories', File.dirname(destination)))
Expand Down
6 changes: 3 additions & 3 deletions gitlab/spec/lib/backup/gitaly_rpc_backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
create(:wiki_page, container: project)
create(:design, :with_file, issue: create(:issue, project: project))
project_snippet = create(:project_snippet, :repository, project: project)
personal_snippet = create(:personal_snippet, :repository, author: project.owner)
personal_snippet = create(:personal_snippet, :repository, author: project.first_owner)

subject.start(:create)
subject.enqueue(project, Gitlab::GlRepository::PROJECT)
Expand Down Expand Up @@ -75,8 +75,8 @@

context 'restore' do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.owner) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.first_owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.first_owner) }

def copy_bundle_to_backup_path(bundle_name, destination)
FileUtils.mkdir_p(File.join(Gitlab.config.backup.path, 'repositories', File.dirname(destination)))
Expand Down
6 changes: 3 additions & 3 deletions gitlab/spec/lib/backup/repositories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
RSpec.shared_examples 'creates repository bundles' do
it 'calls enqueue for each repository type', :aggregate_failures do
project_snippet = create(:project_snippet, :repository, project: project)
personal_snippet = create(:personal_snippet, :repository, author: project.owner)
personal_snippet = create(:personal_snippet, :repository, author: project.first_owner)

subject.dump(max_concurrency: 1, max_storage_concurrency: 1)

Expand Down Expand Up @@ -172,8 +172,8 @@

describe '#restore' do
let_it_be(:project) { create(:project) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.owner) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.first_owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.first_owner) }

it 'calls enqueue for each repository type', :aggregate_failures do
subject.restore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def helper
enable_design_management(enabled)
end

let(:current_user) { project.owner }
let(:current_user) { project.first_owner }
let(:enabled) { true }
let(:matches) { Issue.link_reference_pattern.match(input_text) }
let(:extras) { subject.object_link_text_extras(issue, matches) }
Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/banzai/object_renderer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RSpec.describe Banzai::ObjectRenderer do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:renderer) do
described_class.new(
default_project: project,
Expand Down
4 changes: 2 additions & 2 deletions gitlab/spec/lib/feature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,13 @@
describe '#targets' do
let(:project) { create(:project) }
let(:group) { create(:group) }
let(:user_name) { project.owner.username }
let(:user_name) { project.first_owner.username }

subject { described_class.new(user: user_name, project: project.full_path, group: group.full_path) }

it 'returns all found targets' do
expect(subject.targets).to be_an(Array)
expect(subject.targets).to eq([project.owner, project, group])
expect(subject.targets).to eq([project.first_owner, project, group])
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/gitlab/ci/config/external/rules_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
let(:context) { double(project: project, sha: project.repository.tree.sha, top_level_worktree_paths: ['Dockerfile']) }

before do
project.repository.create_file(project.owner, 'Dockerfile', "commit", message: 'test', branch_name: "master")
project.repository.create_file(project.first_owner, 'Dockerfile', "commit", message: 'test', branch_name: "master")
end

it { is_expected.to eq(true) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
describe 'the created pipeline' do
let_it_be(:project) { create(:project, :auto_devops, :custom_repo, files: { 'README.md' => '' }) }

let(:user) { project.owner }
let(:user) { project.first_owner }
let(:default_branch) { 'master' }
let(:pipeline_branch) { default_branch }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let(:default_branch) { project.default_branch_or_main }
let(:pipeline_branch) { default_branch }
let(:project) { create(:project, :auto_devops, :custom_repo, files: { 'README.md' => '' }) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push).payload }
let(:build_names) { pipeline.builds.pluck(:name) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

describe 'the created pipeline' do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }

let(:default_branch) { 'master' }
let(:pipeline_ref) { default_branch }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

describe 'the created pipeline' do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }

let(:default_branch) { 'master' }
let(:pipeline_ref) { default_branch }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
describe 'the created pipeline' do
let_it_be(:project, refind: true) { create(:project, :repository) }

let(:user) { project.owner }
let(:user) { project.first_owner }
let(:default_branch) { 'master' }
let(:pipeline_ref) { default_branch }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_ref) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

describe 'the created pipeline' do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }

let(:default_branch) { 'main' }
let(:pipeline_ref) { default_branch }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

describe 'the created pipeline' do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }

let(:default_branch) { 'master' }
let(:pipeline_ref) { default_branch }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let(:default_branch) { 'master' }
let(:pipeline_branch) { default_branch }
let(:project) { create(:project, :custom_repo, files: { 'README.md' => '' }) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push).payload }
let(:build_names) { pipeline.builds.pluck(:name) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let(:default_branch) { 'master' }
let(:pipeline_branch) { default_branch }
let(:project) { create(:project, :custom_repo, files: { 'README.md' => '' }) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push).payload }
let(:build_names) { pipeline.builds.pluck(:name) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

describe 'the created pipeline' do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }

let(:default_branch) { 'master' }
let(:pipeline_ref) { default_branch }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
describe 'the created pipeline' do
let(:pipeline_branch) { default_branch }
let(:project) { create(:project, :auto_devops, :custom_repo, files: { 'README.md' => '' }) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push).payload }
let(:build_names) { pipeline.builds.pluck(:name) }
Expand Down Expand Up @@ -276,7 +276,7 @@

with_them do
let(:project) { create(:project, :custom_repo, files: files) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: default_branch ) }
let(:pipeline) { service.execute(:push).payload }
let(:build_names) { pipeline.builds.pluck(:name) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
describe 'the created pipeline' do
let(:pipeline_branch) { 'master' }
let(:project) { create(:project, :custom_repo, files: { 'README.md' => '' }) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push).payload }
let(:build_names) { pipeline.builds.pluck(:name) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
describe 'the created pipeline' do
let(:pipeline_branch) { 'master' }
let(:project) { create(:project, :custom_repo, files: { 'Dockerfile' => 'FROM alpine:latest' }) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push).payload }
let(:build_names) { pipeline.builds.pluck(:name) }
Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/gitlab/ci/templates/npm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let(:repo_files) { { 'package.json' => '{}', 'README.md' => '' } }
let(:modified_files) { %w[package.json] }
let(:project) { create(:project, :custom_repo, files: repo_files) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:pipeline_branch) { project.default_branch }
let(:pipeline_tag) { 'v1.2.1' }
let(:pipeline_ref) { pipeline_branch }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
let(:default_branch) { project.default_branch_or_main }
let(:pipeline_branch) { default_branch }
let(:project) { create(:project, :custom_repo, files: { 'README.md' => '' }) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push).payload }
let(:build_names) { pipeline.builds.pluck(:name) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
let(:default_branch) { project.default_branch_or_main }
let(:pipeline_branch) { default_branch }
let(:project) { create(:project, :custom_repo, files: { 'README.md' => '' }) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push).payload }
let(:build_names) { pipeline.builds.pluck(:name) }
Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/gitlab/ci/variables/builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RSpec.describe Gitlab::Ci::Variables::Builder do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }
let_it_be(:job) do
create(:ci_build,
pipeline: pipeline,
Expand Down
6 changes: 3 additions & 3 deletions gitlab/spec/lib/gitlab/diff/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
def create_file(file_name, content)
Files::CreateService.new(
project,
project.owner,
project.first_owner,
commit_message: 'Update',
start_branch: branch_name,
branch_name: branch_name,
Expand All @@ -27,7 +27,7 @@ def create_file(file_name, content)
def update_file(file_name, content)
Files::UpdateService.new(
project,
project.owner,
project.first_owner,
commit_message: 'Update',
start_branch: branch_name,
branch_name: branch_name,
Expand All @@ -41,7 +41,7 @@ def update_file(file_name, content)
def delete_file(file_name)
Files::DeleteService.new(
project,
project.owner,
project.first_owner,
commit_message: 'Update',
start_branch: branch_name,
branch_name: branch_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
include PositionTracerHelpers

let(:project) { create(:project, :repository) }
let(:current_user) { project.owner }
let(:current_user) { project.first_owner }
let(:file_name) { 'test-file' }
let(:new_file_name) { "#{file_name}-new" }
let(:second_file_name) { "#{file_name}-2" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
include PositionTracerHelpers

let(:project) { create(:project, :repository) }
let(:current_user) { project.owner }
let(:current_user) { project.first_owner }
let(:repository) { project.repository }
let(:file_name) { "test-file" }
let(:new_file_name) { "#{file_name}-new" }
Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/gitlab/diff/position_tracer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

describe 'diffs methods' do
let(:project) { create(:project, :repository) }
let(:current_user) { project.owner }
let(:current_user) { project.first_owner }

let(:old_diff_refs) do
diff_refs(
Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/gitlab/git/wiki_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using RSpec::Parameterized::TableSyntax

let(:project) { create(:project) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:project_wiki) { ProjectWiki.new(project, user) }

subject(:wiki) { project_wiki.wiki }
Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/gitlab/git_access_design_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
include DesignManagementTestHelpers

let_it_be(:project) { create(:project) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }

let(:protocol) { 'web' }
let(:actor) { user }
Expand Down
4 changes: 2 additions & 2 deletions gitlab/spec/lib/gitlab/gl_repository/identifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

RSpec.describe Gitlab::GlRepository::Identifier do
let_it_be(:project) { create(:project) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.owner) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.first_owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.first_owner) }

describe 'project repository' do
it_behaves_like 'parsing gl_repository identifier' do
Expand Down
4 changes: 2 additions & 2 deletions gitlab/spec/lib/gitlab/gl_repository/repo_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

RSpec.describe Gitlab::GlRepository::RepoType do
let_it_be(:project) { create(:project) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.owner) }
let_it_be(:personal_snippet) { create(:personal_snippet, author: project.first_owner) }
let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.first_owner) }

let(:project_path) { project.repository.full_path }
let(:wiki_path) { project.wiki.repository.full_path }
Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/gitlab/graphql/markdown_field_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
end

it 'shows the reference to users that are allowed to see it' do
context = GraphQL::Query::Context.new(query: query, values: { current_user: project.owner }, object: nil)
context = GraphQL::Query::Context.new(query: query, values: { current_user: project.first_owner }, object: nil)
type_instance = type_class.authorized_new(note, context)

expect(field.to_graphql.resolve(type_instance, {}, context)).to include(issue_path(issue))
Expand Down
2 changes: 1 addition & 1 deletion gitlab/spec/lib/gitlab/project_authorizations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def map_access_levels(rows)
let(:common_id) { non_existing_record_id }
let!(:group) { create(:group, id: common_id) }
let!(:unrelated_project) { create(:project, id: common_id) }
let(:user) { unrelated_project.owner }
let(:user) { unrelated_project.first_owner }

it 'does not have access to group and its projects' do
mapping = map_access_levels(authorizations)
Expand Down
Loading

0 comments on commit 0725594

Please sign in to comment.