Commit e6132ec8 authored by charlie ablett's avatar charlie ablett

Replace owner with first_owner in specs

In spec/graphql and spec/controllers
parent 68755b38
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe AutocompleteController do RSpec.describe AutocompleteController do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { project.owner } let(:user) { project.first_owner }
context 'GET users' do context 'GET users' do
let!(:user2) { create(:user) } let!(:user2) { create(:user) }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Projects::ArtifactsController do RSpec.describe Projects::ArtifactsController do
include RepoHelpers include RepoHelpers
let(:user) { project.owner } let(:user) { project.first_owner }
let_it_be(:project) { create(:project, :repository, :public) } let_it_be(:project) { create(:project, :repository, :public) }
let_it_be(:pipeline, reload: true) do let_it_be(:pipeline, reload: true) do
......
...@@ -38,7 +38,7 @@ RSpec.describe Projects::AvatarsController do ...@@ -38,7 +38,7 @@ RSpec.describe Projects::AvatarsController do
end end
it 'sets appropriate caching headers' do it 'sets appropriate caching headers' do
sign_in(project.owner) sign_in(project.first_owner)
subject subject
expect(response.cache_control[:public]).to eq(true) expect(response.cache_control[:public]).to eq(true)
...@@ -63,7 +63,7 @@ RSpec.describe Projects::AvatarsController do ...@@ -63,7 +63,7 @@ RSpec.describe Projects::AvatarsController do
let(:project) { create(:project, :repository, avatar: fixture_file_upload("spec/fixtures/dk.png", "image/png")) } let(:project) { create(:project, :repository, avatar: fixture_file_upload("spec/fixtures/dk.png", "image/png")) }
before do before do
sign_in(project.owner) sign_in(project.first_owner)
end end
it 'removes avatar from DB by calling destroy' do it 'removes avatar from DB by calling destroy' do
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Projects::HooksController do RSpec.describe Projects::HooksController do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
sign_in(user) sign_in(user)
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Projects::MergeRequests::ConflictsController do RSpec.describe Projects::MergeRequests::ConflictsController do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:merge_request_with_conflicts) do let(:merge_request_with_conflicts) do
create(:merge_request, source_branch: 'conflict-resolvable', target_branch: 'conflict-start', source_project: project, merge_status: :unchecked) do |mr| create(:merge_request, source_branch: 'conflict-resolvable', target_branch: 'conflict-start', source_project: project, merge_status: :unchecked) do |mr|
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Projects::MergeRequests::CreationsController do RSpec.describe Projects::MergeRequests::CreationsController do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:fork_project) { create(:forked_project_with_submodules) } let(:fork_project) { create(:forked_project_with_submodules) }
let(:get_diff_params) do let(:get_diff_params) do
{ {
......
...@@ -6,7 +6,7 @@ RSpec.describe Projects::MergeRequests::DraftsController do ...@@ -6,7 +6,7 @@ RSpec.describe Projects::MergeRequests::DraftsController do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:user2) { create(:user) } let(:user2) { create(:user) }
let(:params) do let(:params) do
......
...@@ -9,7 +9,7 @@ RSpec.describe Projects::MergeRequestsController do ...@@ -9,7 +9,7 @@ RSpec.describe Projects::MergeRequestsController do
let_it_be_with_refind(:project) { create(:project, :repository) } let_it_be_with_refind(:project) { create(:project, :repository) }
let_it_be_with_reload(:project_public_with_private_builds) { create(:project, :repository, :public, :builds_private) } let_it_be_with_reload(:project_public_with_private_builds) { create(:project, :repository, :public, :builds_private) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: merge_request_source_project, allow_collaboration: false) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: merge_request_source_project, allow_collaboration: false) }
let(:merge_request_source_project) { project } let(:merge_request_source_project) { project }
......
...@@ -7,7 +7,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -7,7 +7,7 @@ RSpec.describe Projects::MirrorsController do
shared_examples 'only admin is allowed when mirroring is disabled' do shared_examples 'only admin is allowed when mirroring is disabled' do
let(:subject_action) { raise 'subject_action is required' } let(:subject_action) { raise 'subject_action is required' }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:project_settings_path) { project_settings_repository_path(project, anchor: 'js-push-remote-settings') } let(:project_settings_path) { project_settings_repository_path(project, anchor: 'js-push-remote-settings') }
context 'when project mirroring is enabled' do context 'when project mirroring is enabled' do
...@@ -88,7 +88,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -88,7 +88,7 @@ RSpec.describe Projects::MirrorsController do
context 'when the current project is not a mirror' do context 'when the current project is not a mirror' do
it 'allows to create a remote mirror' do it 'allows to create a remote mirror' do
sign_in(project.owner) sign_in(project.first_owner)
expect do expect do
do_put(project, remote_mirrors_attributes: { '0' => { 'enabled' => 1, 'url' => 'http://foo.com' } }) do_put(project, remote_mirrors_attributes: { '0' => { 'enabled' => 1, 'url' => 'http://foo.com' } })
...@@ -106,7 +106,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -106,7 +106,7 @@ RSpec.describe Projects::MirrorsController do
end end
it 'processes a successful update' do it 'processes a successful update' do
sign_in(project.owner) sign_in(project.first_owner)
do_put(project, remote_mirrors_attributes: { '0' => ssh_mirror_attributes }) do_put(project, remote_mirrors_attributes: { '0' => ssh_mirror_attributes })
expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-push-remote-settings')) expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-push-remote-settings'))
...@@ -126,7 +126,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -126,7 +126,7 @@ RSpec.describe Projects::MirrorsController do
let(:project) { create(:project, :repository, :remote_mirror) } let(:project) { create(:project, :repository, :remote_mirror) }
before do before do
sign_in(project.owner) sign_in(project.first_owner)
end end
context 'With valid URL for a push' do context 'With valid URL for a push' do
...@@ -169,7 +169,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -169,7 +169,7 @@ RSpec.describe Projects::MirrorsController do
let(:cache) { SshHostKey.new(project: project, url: "ssh://example.com:22") } let(:cache) { SshHostKey.new(project: project, url: "ssh://example.com:22") }
before do before do
sign_in(project.owner) sign_in(project.first_owner)
end end
context 'invalid URLs' do context 'invalid URLs' do
......
...@@ -1169,7 +1169,7 @@ RSpec.describe Projects::PipelinesController do ...@@ -1169,7 +1169,7 @@ RSpec.describe Projects::PipelinesController do
context 'when user has ability to delete pipeline' do context 'when user has ability to delete pipeline' do
before do before do
sign_in(project.owner) sign_in(project.first_owner)
end end
it 'deletes pipeline and redirects' do it 'deletes pipeline and redirects' do
......
...@@ -32,7 +32,7 @@ RSpec.describe Projects::ServicePingController do ...@@ -32,7 +32,7 @@ RSpec.describe Projects::ServicePingController do
shared_examples 'counter is increased' do |counter| shared_examples 'counter is increased' do |counter|
context 'when the authenticated user has access to the project' do context 'when the authenticated user has access to the project' do
let(:user) { project.owner } let(:user) { project.first_owner }
it 'increments the usage counter' do it 'increments the usage counter' do
expect do expect do
...@@ -55,7 +55,7 @@ RSpec.describe Projects::ServicePingController do ...@@ -55,7 +55,7 @@ RSpec.describe Projects::ServicePingController do
end end
context 'when web ide clientside preview is not enabled' do context 'when web ide clientside preview is not enabled' do
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
stub_application_setting(web_ide_clientside_preview_enabled: false) stub_application_setting(web_ide_clientside_preview_enabled: false)
......
...@@ -29,7 +29,7 @@ RSpec.describe Repositories::GitHttpController do ...@@ -29,7 +29,7 @@ RSpec.describe Repositories::GitHttpController do
context 'when repository container is a project' do context 'when repository container is a project' do
it_behaves_like Repositories::GitHttpController do it_behaves_like Repositories::GitHttpController do
let(:container) { project } let(:container) { project }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:access_checker_class) { Gitlab::GitAccess } let(:access_checker_class) { Gitlab::GitAccess }
it_behaves_like 'handles unavailable Gitaly' it_behaves_like 'handles unavailable Gitaly'
...@@ -103,7 +103,7 @@ RSpec.describe Repositories::GitHttpController do ...@@ -103,7 +103,7 @@ RSpec.describe Repositories::GitHttpController do
context 'when repository container is a project wiki' do context 'when repository container is a project wiki' do
it_behaves_like Repositories::GitHttpController do it_behaves_like Repositories::GitHttpController do
let(:container) { create(:project_wiki, :empty_repo, project: project) } let(:container) { create(:project_wiki, :empty_repo, project: project) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:access_checker_class) { Gitlab::GitAccessWiki } let(:access_checker_class) { Gitlab::GitAccessWiki }
end end
end end
......
...@@ -326,7 +326,7 @@ RSpec.describe 'DeclarativePolicy authorization in GraphQL ' do ...@@ -326,7 +326,7 @@ RSpec.describe 'DeclarativePolicy authorization in GraphQL ' do
let!(:other_project) { create(:project, :private) } let!(:other_project) { create(:project, :private) }
let!(:visible_issues) { create_list(:issue, 2, project: visible_project) } let!(:visible_issues) { create_list(:issue, 2, project: visible_project) }
let!(:other_issues) { create_list(:issue, 2, project: other_project) } let!(:other_issues) { create_list(:issue, 2, project: other_project) }
let!(:user) { visible_project.owner } let!(:user) { visible_project.first_owner }
let(:issue_type) do let(:issue_type) do
type_factory do |type| type_factory do |type|
......
...@@ -8,7 +8,7 @@ RSpec.describe Mutations::AlertManagement::Alerts::Todo::Create do ...@@ -8,7 +8,7 @@ RSpec.describe Mutations::AlertManagement::Alerts::Todo::Create do
let_it_be(:alert) { create(:alert_management_alert) } let_it_be(:alert) { create(:alert_management_alert) }
let_it_be(:project) { alert.project } let_it_be(:project) { alert.project }
let(:current_user) { project.owner } let(:current_user) { project.first_owner }
let(:args) { { project_path: project.full_path, iid: alert.iid } } let(:args) { { project_path: project.full_path, iid: alert.iid } }
......
...@@ -121,7 +121,7 @@ RSpec.describe Mutations::Issues::Create do ...@@ -121,7 +121,7 @@ RSpec.describe Mutations::Issues::Create do
end end
context 'when creating an issue as owner' do context 'when creating an issue as owner' do
let_it_be(:user) { project.owner } let_it_be(:user) { project.first_owner }
before do before do
mutation_params.merge!(special_params) mutation_params.merge!(special_params)
......
...@@ -6,7 +6,7 @@ RSpec.describe Resolvers::PackageDetailsResolver do ...@@ -6,7 +6,7 @@ RSpec.describe Resolvers::PackageDetailsResolver do
include GraphqlHelpers include GraphqlHelpers
let_it_be_with_reload(:project) { create(:project) } let_it_be_with_reload(:project) { create(:project) }
let_it_be(:user) { project.owner } let_it_be(:user) { project.first_owner }
let_it_be(:package) { create(:composer_package, project: project) } let_it_be(:package) { create(:composer_package, project: project) }
describe '#resolve' do describe '#resolve' do
......
...@@ -8,7 +8,7 @@ RSpec.describe Resolvers::PackagePipelinesResolver do ...@@ -8,7 +8,7 @@ RSpec.describe Resolvers::PackagePipelinesResolver do
let_it_be_with_reload(:package) { create(:package) } let_it_be_with_reload(:package) { create(:package) }
let_it_be(:pipelines) { create_list(:ci_pipeline, 3, project: package.project) } let_it_be(:pipelines) { create_list(:ci_pipeline, 3, project: package.project) }
let(:user) { package.project.owner } let(:user) { package.project.first_owner }
let(:args) { {} } let(:args) { {} }
describe '#resolve' do describe '#resolve' do
......
...@@ -191,7 +191,7 @@ RSpec.describe Types::GlobalIDType do ...@@ -191,7 +191,7 @@ RSpec.describe Types::GlobalIDType do
describe 'executing against the schema' do describe 'executing against the schema' do
let(:query_result) do let(:query_result) do
context = { current_user: issue.project.owner } context = { current_user: issue.project.first_owner }
variables = { 'id' => gid } variables = { 'id' => gid }
run_with_clean_state(query, context: context, variables: variables).to_h run_with_clean_state(query, context: context, variables: variables).to_h
......
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