Commit 36687b2a authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '350603-cablett-project-owner-specs-2' into 'master'

Replace owner with first_owner in controller/graphql specs

See merge request gitlab-org/gitlab!78628
parents 18082245 e6132ec8
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe AutocompleteController do
let(:project) { create(:project) }
let(:user) { project.owner }
let(:user) { project.first_owner }
context 'GET users' do
let!(:user2) { create(:user) }
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Projects::ArtifactsController do
include RepoHelpers
let(:user) { project.owner }
let(:user) { project.first_owner }
let_it_be(:project) { create(:project, :repository, :public) }
let_it_be(:pipeline, reload: true) do
......
......@@ -38,7 +38,7 @@ RSpec.describe Projects::AvatarsController do
end
it 'sets appropriate caching headers' do
sign_in(project.owner)
sign_in(project.first_owner)
subject
expect(response.cache_control[:public]).to eq(true)
......@@ -63,7 +63,7 @@ RSpec.describe Projects::AvatarsController do
let(:project) { create(:project, :repository, avatar: fixture_file_upload("spec/fixtures/dk.png", "image/png")) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
it 'removes avatar from DB by calling destroy' do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Projects::HooksController do
let_it_be(:project) { create(:project) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Projects::MergeRequests::ConflictsController do
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_with_conflicts) do
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'
RSpec.describe Projects::MergeRequests::CreationsController do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:fork_project) { create(:forked_project_with_submodules) }
let(:get_diff_params) do
{
......
......@@ -6,7 +6,7 @@ RSpec.describe Projects::MergeRequests::DraftsController do
let(:project) { create(:project, :repository) }
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(:params) do
......
......@@ -9,7 +9,7 @@ RSpec.describe Projects::MergeRequestsController do
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(: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_source_project) { project }
......
......@@ -7,7 +7,7 @@ RSpec.describe Projects::MirrorsController do
shared_examples 'only admin is allowed when mirroring is disabled' do
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') }
context 'when project mirroring is enabled' do
......@@ -88,7 +88,7 @@ RSpec.describe Projects::MirrorsController do
context 'when the current project is not a mirror' do
it 'allows to create a remote mirror' do
sign_in(project.owner)
sign_in(project.first_owner)
expect do
do_put(project, remote_mirrors_attributes: { '0' => { 'enabled' => 1, 'url' => 'http://foo.com' } })
......@@ -106,7 +106,7 @@ RSpec.describe Projects::MirrorsController do
end
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 })
expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-push-remote-settings'))
......@@ -126,7 +126,7 @@ RSpec.describe Projects::MirrorsController do
let(:project) { create(:project, :repository, :remote_mirror) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
context 'With valid URL for a push' do
......@@ -169,7 +169,7 @@ RSpec.describe Projects::MirrorsController do
let(:cache) { SshHostKey.new(project: project, url: "ssh://example.com:22") }
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
context 'invalid URLs' do
......
......@@ -1169,7 +1169,7 @@ RSpec.describe Projects::PipelinesController do
context 'when user has ability to delete pipeline' do
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
it 'deletes pipeline and redirects' do
......
......@@ -32,7 +32,7 @@ RSpec.describe Projects::ServicePingController do
shared_examples 'counter is increased' do |counter|
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
expect do
......@@ -55,7 +55,7 @@ RSpec.describe Projects::ServicePingController do
end
context 'when web ide clientside preview is not enabled' do
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
stub_application_setting(web_ide_clientside_preview_enabled: false)
......
......@@ -29,7 +29,7 @@ RSpec.describe Repositories::GitHttpController do
context 'when repository container is a project' do
it_behaves_like Repositories::GitHttpController do
let(:container) { project }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:access_checker_class) { Gitlab::GitAccess }
it_behaves_like 'handles unavailable Gitaly'
......@@ -103,7 +103,7 @@ RSpec.describe Repositories::GitHttpController do
context 'when repository container is a project wiki' do
it_behaves_like Repositories::GitHttpController do
let(:container) { create(:project_wiki, :empty_repo, project: project) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:access_checker_class) { Gitlab::GitAccessWiki }
end
end
......
......@@ -326,7 +326,7 @@ RSpec.describe 'DeclarativePolicy authorization in GraphQL ' do
let!(:other_project) { create(:project, :private) }
let!(:visible_issues) { create_list(:issue, 2, project: visible_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
type_factory do |type|
......
......@@ -8,7 +8,7 @@ RSpec.describe Mutations::AlertManagement::Alerts::Todo::Create do
let_it_be(:alert) { create(:alert_management_alert) }
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 } }
......
......@@ -121,7 +121,7 @@ RSpec.describe Mutations::Issues::Create do
end
context 'when creating an issue as owner' do
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }
before do
mutation_params.merge!(special_params)
......
......@@ -6,7 +6,7 @@ RSpec.describe Resolvers::PackageDetailsResolver do
include GraphqlHelpers
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) }
describe '#resolve' do
......
......@@ -8,7 +8,7 @@ RSpec.describe Resolvers::PackagePipelinesResolver do
let_it_be_with_reload(:package) { create(:package) }
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) { {} }
describe '#resolve' do
......
......@@ -191,7 +191,7 @@ RSpec.describe Types::GlobalIDType do
describe 'executing against the schema' do
let(:query_result) do
context = { current_user: issue.project.owner }
context = { current_user: issue.project.first_owner }
variables = { 'id' => gid }
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