Commit c027920b authored by charlie ablett's avatar charlie ablett

Replace owner with first_owner in EE spec fixtures

parent 99be341f
...@@ -142,7 +142,7 @@ RSpec.describe AutocompleteController do ...@@ -142,7 +142,7 @@ RSpec.describe AutocompleteController do
end end
context 'as project owner' do context 'as project owner' do
let(:user) { project.owner } let(:user) { project.first_owner }
let!(:expected_results) { [[project.id, 'Project']] } let!(:expected_results) { [[project.id, 'Project']] }
context "while searching for a project by namespace" do context "while searching for a project by namespace" do
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Projects::BranchesController do RSpec.describe Projects::BranchesController do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
allow(project).to receive(:branches).and_return(['master']) allow(project).to receive(:branches).and_return(['master'])
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,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(: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(:viewer) { user } let(:viewer) { user }
before do before do
......
...@@ -7,14 +7,16 @@ RSpec.describe Projects::MirrorsController do ...@@ -7,14 +7,16 @@ RSpec.describe Projects::MirrorsController do
describe 'setting up a remote mirror' do describe 'setting up a remote mirror' do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let_it_be(:first_owner) { project.first_owner }
let(:url) { 'http://foo.com' } let(:url) { 'http://foo.com' }
context 'when the current project is a mirror' do context 'when the current project is a mirror' do
let(:project) { create(:project, :repository, :mirror) } let(:project) { create(:project, :repository, :mirror) }
let(:first_owner) { project.first_owner }
before do before do
sign_in(project.owner) sign_in(first_owner)
end end
it 'allows to create a remote mirror' do it 'allows to create a remote mirror' do
...@@ -28,7 +30,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -28,7 +30,7 @@ RSpec.describe Projects::MirrorsController do
let(:remote_mirror) { project.remote_mirrors.create!(enabled: 1, url: 'http://local.dev') } let(:remote_mirror) { project.remote_mirrors.create!(enabled: 1, url: 'http://local.dev') }
before do before do
sign_in(project.owner) sign_in(first_owner)
end end
context 'mirror_user is unset' do context 'mirror_user is unset' do
...@@ -40,7 +42,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -40,7 +42,7 @@ RSpec.describe Projects::MirrorsController do
expect(project.mirror).to eq(true) expect(project.mirror).to eq(true)
expect(project.import_url).to eq('http://local.dev') expect(project.import_url).to eq('http://local.dev')
expect(project.mirror_user).to eq(project.owner) expect(project.mirror_user).to eq(first_owner)
end end
end end
...@@ -53,7 +55,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -53,7 +55,7 @@ RSpec.describe Projects::MirrorsController do
expect(project.mirror).to eq(true) expect(project.mirror).to eq(true)
expect(project.import_url).to eq('http://local.dev') expect(project.import_url).to eq('http://local.dev')
expect(project.mirror_user).to eq(project.owner) expect(project.mirror_user).to eq(first_owner)
end end
end end
end end
...@@ -62,6 +64,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -62,6 +64,7 @@ RSpec.describe Projects::MirrorsController do
describe 'setting up a mirror' do describe 'setting up a mirror' do
let(:url) { 'http://foo.com' } let(:url) { 'http://foo.com' }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:first_owner) { project.first_owner }
context 'when mirrors are disabled' do context 'when mirrors are disabled' do
before do before do
...@@ -82,7 +85,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -82,7 +85,7 @@ RSpec.describe Projects::MirrorsController do
context 'when user is not an admin' do context 'when user is not an admin' do
it 'does not create a new mirror' do it 'does not create a new mirror' do
sign_in(project.owner) sign_in(first_owner)
expect do expect do
do_put(project, mirror: true, import_url: url) do_put(project, mirror: true, import_url: url)
...@@ -93,13 +96,13 @@ RSpec.describe Projects::MirrorsController do ...@@ -93,13 +96,13 @@ RSpec.describe Projects::MirrorsController do
context 'when mirrors are enabled' do context 'when mirrors are enabled' do
before do before do
sign_in(project.owner) sign_in(first_owner)
end end
context 'when project does not have a mirror' do context 'when project does not have a mirror' do
it 'allows to create a mirror' do it 'allows to create a mirror' do
expect do expect do
do_put(project, mirror: true, mirror_user_id: project.owner.id, import_url: url) do_put(project, mirror: true, mirror_user_id: first_owner.id, import_url: url)
end.to change { Project.mirror.count }.to(1) end.to change { Project.mirror.count }.to(1)
end end
end end
...@@ -117,7 +120,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -117,7 +120,7 @@ RSpec.describe Projects::MirrorsController do
describe 'forcing an update on a pull mirror' do describe 'forcing an update on a pull mirror' do
it 'forces update' do it 'forces update' do
project = create(:project, :mirror) project = create(:project, :mirror)
sign_in(project.owner) sign_in(project.first_owner)
Sidekiq::Testing.fake! do Sidekiq::Testing.fake! do
expect { put :update_now, params: { namespace_id: project.namespace.to_param, project_id: project.to_param } } expect { put :update_now, params: { namespace_id: project.namespace.to_param, project_id: project.to_param } }
...@@ -129,10 +132,11 @@ RSpec.describe Projects::MirrorsController do ...@@ -129,10 +132,11 @@ RSpec.describe Projects::MirrorsController do
describe '#update' do describe '#update' do
let(:project) { create(:project, :repository, :mirror, :remote_mirror) } let(:project) { create(:project, :repository, :mirror, :remote_mirror) }
let(:attributes) { { project: { mirror_user_id: project.owner.id, mirror_trigger_builds: 0 }, namespace_id: project.namespace.to_param, project_id: project.to_param } } let(:first_owner) { project.first_owner }
let(:attributes) { { project: { mirror_user_id: first_owner.id, mirror_trigger_builds: 0 }, namespace_id: project.namespace.to_param, project_id: project.to_param } }
before do before do
sign_in(project.owner) sign_in(first_owner)
end end
around do |example| around do |example|
...@@ -170,7 +174,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -170,7 +174,7 @@ RSpec.describe Projects::MirrorsController do
import_data = project.reload_import_data import_data = project.reload_import_data
expect(import_data.ssh_known_hosts_verified_at).to be_within(1.minute).of(Time.current) expect(import_data.ssh_known_hosts_verified_at).to be_within(1.minute).of(Time.current)
expect(import_data.ssh_known_hosts_verified_by).to eq(project.owner) expect(import_data.ssh_known_hosts_verified_by).to eq(first_owner)
end end
it 'unsets ssh_known_hosts_verified_at and verified_by when the update unsets known hosts' do it 'unsets ssh_known_hosts_verified_at and verified_by when the update unsets known hosts' do
...@@ -191,7 +195,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -191,7 +195,7 @@ RSpec.describe Projects::MirrorsController do
do_put(project, { mirror_user_id: other_user.id }, format: :json) do_put(project, { mirror_user_id: other_user.id }, format: :json)
expect(project.reload.mirror_user).to eq(project.owner) expect(project.reload.mirror_user).to eq(first_owner)
end end
end end
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Projects::PathLocksController do RSpec.describe Projects::PathLocksController do
let_it_be(:project) { create(:project, :repository, :public) } let_it_be(:project) { create(:project, :repository, :public) }
let_it_be(:user) { project.owner } let_it_be(:user) { project.first_owner }
let(:file_path) { 'files/lfs/lfs_object.iso' } let(:file_path) { 'files/lfs/lfs_object.iso' }
let(:lfs_enabled) { true } let(:lfs_enabled) { true }
......
...@@ -561,7 +561,7 @@ RSpec.describe ProjectsController do ...@@ -561,7 +561,7 @@ RSpec.describe ProjectsController do
context 'current_user is a project owner' do context 'current_user is a project owner' do
before do before do
sign_in(project.owner) sign_in(project.first_owner)
end end
it 'sets the compliance framework' do it 'sets the compliance framework' do
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Repository index', :elastic, :clean_gitlab_redis_shared_state do RSpec.describe 'Repository index', :elastic, :clean_gitlab_redis_shared_state do
context 'when fresh master branch is first pushed, followed by another update, then indexed' do context 'when fresh master branch is first pushed, followed by another update, then indexed' do
let(:project) { create(:project_empty_repo) } let(:project) { create(:project_empty_repo) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true) stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
......
...@@ -7,7 +7,7 @@ RSpec.describe 'EE IDE user commits changes', :js do ...@@ -7,7 +7,7 @@ RSpec.describe 'EE IDE user commits changes', :js do
let(:project) { create(:project, :custom_repo, files: { 'docs/CODEOWNERS' => "[Backend]\n*.rb @ruby-owner" }) } let(:project) { create(:project, :custom_repo, files: { 'docs/CODEOWNERS' => "[Backend]\n*.rb @ruby-owner" }) }
let(:ruby_owner) { create(:user, username: 'ruby-owner') } let(:ruby_owner) { create(:user, username: 'ruby-owner') }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
stub_licensed_features(code_owners: true, code_owner_approval_required: true) stub_licensed_features(code_owners: true, code_owner_approval_required: true)
......
...@@ -9,7 +9,7 @@ RSpec.describe 'EE user opens IDE', :js do ...@@ -9,7 +9,7 @@ RSpec.describe 'EE user opens IDE', :js do
let_it_be(:unsigned_commits_warning) { 'This project does not accept unsigned commits.' } let_it_be(:unsigned_commits_warning) { 'This project does not accept unsigned commits.' }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
stub_licensed_features(push_rules: true) stub_licensed_features(push_rules: true)
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'User creates a merge request with blocking MRs', :js do RSpec.describe 'User creates a merge request with blocking MRs', :js do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:mr_params) { { title: 'Some feature', source_branch: 'fix', target_branch: 'feature' } } let(:mr_params) { { title: 'Some feature', source_branch: 'fix', target_branch: 'feature' } }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe "User edits merge request with blocking MRs", :js do RSpec.describe "User edits merge request with blocking MRs", :js do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:project) { merge_request.target_project } let(:project) { merge_request.target_project }
let(:user) { merge_request.target_project.owner } let(:user) { merge_request.target_project.first_owner }
let(:other_mr) { create(:merge_request) } let(:other_mr) { create(:merge_request) }
......
...@@ -6,7 +6,7 @@ RSpec.describe 'Two merge requests on a merge train' do ...@@ -6,7 +6,7 @@ RSpec.describe 'Two merge requests on a merge train' do
include RepoHelpers include RepoHelpers
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:key) { create(:key, user: project.owner) } let(:key) { create(:key, user: project.first_owner) }
let_it_be(:maintainer_1) { create(:user) } let_it_be(:maintainer_1) { create(:user) }
let_it_be(:maintainer_2) { create(:user) } let_it_be(:maintainer_2) { create(:user) }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Project active tab' do RSpec.describe 'Project active tab' do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
sign_in(user) sign_in(user)
......
...@@ -127,7 +127,7 @@ RSpec.describe 'Projects > Audit Events', :js do ...@@ -127,7 +127,7 @@ RSpec.describe 'Projects > Audit Events', :js do
page.within('.audit-log-table') do page.within('.audit-log-table') do
expect(page).to have_content 'Changed access level from Developer to Maintainer' expect(page).to have_content 'Changed access level from Developer to Maintainer'
expect(page).to have_content(project.owner.name) expect(page).to have_content(project.first_owner.name)
expect(page).to have_content('Pete') expect(page).to have_content('Pete')
end end
end end
...@@ -166,7 +166,7 @@ RSpec.describe 'Projects > Audit Events', :js do ...@@ -166,7 +166,7 @@ RSpec.describe 'Projects > Audit Events', :js do
wait_for_all_requests wait_for_all_requests
page.within('.audit-log-table') do page.within('.audit-log-table') do
expect(page).to have_content(project.owner.name) expect(page).to have_content(project.first_owner.name)
expect(page).to have_content('Changed prevent merge request approval from authors') expect(page).to have_content('Changed prevent merge request approval from authors')
expect(page).to have_content('Changed prevent merge request approval from committers') expect(page).to have_content('Changed prevent merge request approval from committers')
expect(page).to have_content(project.name) expect(page).to have_content(project.name)
......
...@@ -5,7 +5,7 @@ RSpec.describe 'Kerberos clone instructions', :js do ...@@ -5,7 +5,7 @@ RSpec.describe 'Kerberos clone instructions', :js do
include MobileHelpers include MobileHelpers
let(:project) { create(:project, :empty_repo) } let(:project) { create(:project, :empty_repo) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
sign_in(user) sign_in(user)
......
...@@ -9,7 +9,7 @@ RSpec.describe 'Project navbar' do ...@@ -9,7 +9,7 @@ RSpec.describe 'Project navbar' do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
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 'EE > Projects > Settings > User manages approval rule settings' do RSpec.describe 'EE > Projects > Settings > User manages approval rule settings' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:path) { edit_project_path(project) } let(:path) { edit_project_path(project) }
let(:licensed_features) { {} } let(:licensed_features) { {} }
let(:project_features) { {} } let(:project_features) { {} }
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'File blob > Code owners', :js do RSpec.describe 'File blob > Code owners', :js do
let(:project) { create(:project, :private, :repository) } let(:project) { create(:project, :private, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:code_owner) { create(:user, username: 'documentation-owner') } let(:code_owner) { create(:user, username: 'documentation-owner') }
before do before do
......
...@@ -38,7 +38,7 @@ RSpec.describe 'Project', :js do ...@@ -38,7 +38,7 @@ RSpec.describe 'Project', :js do
describe 'immediately deleting a project marked for deletion' do describe 'immediately deleting a project marked for deletion' do
let(:project) { create(:project, marked_for_deletion_at: Date.current) } let(:project) { create(:project, marked_for_deletion_at: Date.current) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
stub_licensed_features(adjourned_deletion_for_projects_and_groups: true) stub_licensed_features(adjourned_deletion_for_projects_and_groups: true)
......
...@@ -6,7 +6,7 @@ RSpec.describe 'Protected Branches', :js do ...@@ -6,7 +6,7 @@ RSpec.describe 'Protected Branches', :js do
include ProtectedBranchHelpers include ProtectedBranchHelpers
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
sign_in(user) sign_in(user)
......
...@@ -6,7 +6,7 @@ RSpec.describe 'Protected Tags', :js do ...@@ -6,7 +6,7 @@ RSpec.describe 'Protected Tags', :js do
include ProtectedTagHelpers include ProtectedTagHelpers
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.first_owner }
before do before do
sign_in(user) sign_in(user)
......
...@@ -6,8 +6,8 @@ RSpec.describe "Internal Project Snippets Access" do ...@@ -6,8 +6,8 @@ RSpec.describe "Internal Project Snippets Access" do
include AccessMatchers include AccessMatchers
let_it_be(:project) { create(:project, :internal) } let_it_be(:project) { create(:project, :internal) }
let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.owner) } let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.first_owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.owner) } let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.first_owner) }
describe "GET /:project_path/snippets" do describe "GET /:project_path/snippets" do
subject { project_snippets_path(project) } subject { project_snippets_path(project) }
......
...@@ -6,7 +6,7 @@ RSpec.describe "Private Project Snippets Access" do ...@@ -6,7 +6,7 @@ RSpec.describe "Private Project Snippets Access" do
include AccessMatchers include AccessMatchers
let_it_be(:project) { create(:project, :private) } let_it_be(:project) { create(:project, :private) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.owner) } let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.first_owner) }
describe "GET /:project_path/snippets" do describe "GET /:project_path/snippets" do
subject { project_snippets_path(project) } subject { project_snippets_path(project) }
......
...@@ -6,9 +6,9 @@ RSpec.describe "Public Project Snippets Access" do ...@@ -6,9 +6,9 @@ RSpec.describe "Public Project Snippets Access" do
include AccessMatchers include AccessMatchers
let_it_be(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
let_it_be(:public_snippet) { create(:project_snippet, :public, project: project, author: project.owner) } let_it_be(:public_snippet) { create(:project_snippet, :public, project: project, author: project.first_owner) }
let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.owner) } let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.first_owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.owner) } let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.first_owner) }
describe "GET /:project_path/snippets" do describe "GET /:project_path/snippets" do
subject { project_snippets_path(project) } subject { project_snippets_path(project) }
......
...@@ -6,7 +6,7 @@ RSpec.describe ProductivityAnalyticsFinder do ...@@ -6,7 +6,7 @@ RSpec.describe ProductivityAnalyticsFinder do
subject { described_class.new(current_user, search_params.merge(state: :merged)) } subject { described_class.new(current_user, search_params.merge(state: :merged)) }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:current_user) { project.owner } let(:current_user) { project.first_owner }
let(:search_params) { {} } let(:search_params) { {} }
describe '.array_params' do describe '.array_params' do
......
...@@ -6,7 +6,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures in EE co ...@@ -6,7 +6,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures in EE co
include JavaScriptFixturesHelpers include JavaScriptFixturesHelpers
let(:project) { create(:project, :repository, path: 'merge-requests-project') } let(:project) { create(:project, :repository, path: 'merge-requests-project') }
let(:user) { project.owner } let(:user) { project.first_owner }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
render_views render_views
......
...@@ -10,7 +10,7 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do ...@@ -10,7 +10,7 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'builds-project', runners_token: runners_token, avatar: fixture_file_upload('spec/fixtures/dk.png', 'image/png')) } let(:project) { create(:project, namespace: namespace, path: 'builds-project', runners_token: runners_token, avatar: fixture_file_upload('spec/fixtures/dk.png', 'image/png')) }
let(:user) { project.owner } let(:user) { project.first_owner }
describe GraphQL::Query, type: :request do describe GraphQL::Query, type: :request do
include GraphqlHelpers include GraphqlHelpers
......
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