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
end
context 'as project owner' do
let(:user) { project.owner }
let(:user) { project.first_owner }
let!(:expected_results) { [[project.id, 'Project']] }
context "while searching for a project by namespace" do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Projects::BranchesController do
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
allow(project).to receive(:branches).and_return(['master'])
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Projects::MergeRequests::CreationsController 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(:viewer) { user }
before do
......
......@@ -7,14 +7,16 @@ RSpec.describe Projects::MirrorsController do
describe 'setting up a remote mirror' do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:first_owner) { project.first_owner }
let(:url) { 'http://foo.com' }
context 'when the current project is a mirror' do
let(:project) { create(:project, :repository, :mirror) }
let(:first_owner) { project.first_owner }
before do
sign_in(project.owner)
sign_in(first_owner)
end
it 'allows to create a remote mirror' do
......@@ -28,7 +30,7 @@ RSpec.describe Projects::MirrorsController do
let(:remote_mirror) { project.remote_mirrors.create!(enabled: 1, url: 'http://local.dev') }
before do
sign_in(project.owner)
sign_in(first_owner)
end
context 'mirror_user is unset' do
......@@ -40,7 +42,7 @@ RSpec.describe Projects::MirrorsController do
expect(project.mirror).to eq(true)
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
......@@ -53,7 +55,7 @@ RSpec.describe Projects::MirrorsController do
expect(project.mirror).to eq(true)
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
......@@ -62,6 +64,7 @@ RSpec.describe Projects::MirrorsController do
describe 'setting up a mirror' do
let(:url) { 'http://foo.com' }
let(:project) { create(:project, :repository) }
let(:first_owner) { project.first_owner }
context 'when mirrors are disabled' do
before do
......@@ -82,7 +85,7 @@ RSpec.describe Projects::MirrorsController do
context 'when user is not an admin' do
it 'does not create a new mirror' do
sign_in(project.owner)
sign_in(first_owner)
expect do
do_put(project, mirror: true, import_url: url)
......@@ -93,13 +96,13 @@ RSpec.describe Projects::MirrorsController do
context 'when mirrors are enabled' do
before do
sign_in(project.owner)
sign_in(first_owner)
end
context 'when project does not have a mirror' do
it 'allows to create a mirror' 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
end
......@@ -117,7 +120,7 @@ RSpec.describe Projects::MirrorsController do
describe 'forcing an update on a pull mirror' do
it 'forces update' do
project = create(:project, :mirror)
sign_in(project.owner)
sign_in(project.first_owner)
Sidekiq::Testing.fake! do
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
describe '#update' do
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
sign_in(project.owner)
sign_in(first_owner)
end
around do |example|
......@@ -170,7 +174,7 @@ RSpec.describe Projects::MirrorsController do
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_by).to eq(project.owner)
expect(import_data.ssh_known_hosts_verified_by).to eq(first_owner)
end
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
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
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Projects::PathLocksController do
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(:lfs_enabled) { true }
......
......@@ -561,7 +561,7 @@ RSpec.describe ProjectsController do
context 'current_user is a project owner' do
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
it 'sets the compliance framework' do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
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
let(:project) { create(:project_empty_repo) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
......
......@@ -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(:ruby_owner) { create(:user, username: 'ruby-owner') }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
stub_licensed_features(code_owners: true, code_owner_approval_required: true)
......
......@@ -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(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
stub_licensed_features(push_rules: true)
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'User creates a merge request with blocking MRs', :js do
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' } }
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe "User edits merge request with blocking MRs", :js do
let(:merge_request) { create(:merge_request) }
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) }
......
......@@ -6,7 +6,7 @@ RSpec.describe 'Two merge requests on a merge train' do
include RepoHelpers
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_2) { create(:user) }
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Project active tab' do
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)
......
......@@ -127,7 +127,7 @@ RSpec.describe 'Projects > Audit Events', :js do
page.within('.audit-log-table') do
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')
end
end
......@@ -166,7 +166,7 @@ RSpec.describe 'Projects > Audit Events', :js do
wait_for_all_requests
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 committers')
expect(page).to have_content(project.name)
......
......@@ -5,7 +5,7 @@ RSpec.describe 'Kerberos clone instructions', :js do
include MobileHelpers
let(:project) { create(:project, :empty_repo) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)
......
......@@ -9,7 +9,7 @@ RSpec.describe 'Project navbar' do
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'EE > Projects > Settings > User manages approval rule settings' do
let(:project) { create(:project) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:path) { edit_project_path(project) }
let(:licensed_features) { {} }
let(:project_features) { {} }
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'File blob > Code owners', :js do
let(:project) { create(:project, :private, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:code_owner) { create(:user, username: 'documentation-owner') }
before do
......
......@@ -38,7 +38,7 @@ RSpec.describe 'Project', :js do
describe 'immediately deleting a project marked for deletion' do
let(:project) { create(:project, marked_for_deletion_at: Date.current) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
stub_licensed_features(adjourned_deletion_for_projects_and_groups: true)
......
......@@ -6,7 +6,7 @@ RSpec.describe 'Protected Branches', :js do
include ProtectedBranchHelpers
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)
......
......@@ -6,7 +6,7 @@ RSpec.describe 'Protected Tags', :js do
include ProtectedTagHelpers
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)
......
......@@ -6,8 +6,8 @@ RSpec.describe "Internal Project Snippets Access" do
include AccessMatchers
let_it_be(:project) { create(:project, :internal) }
let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, 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.first_owner) }
describe "GET /:project_path/snippets" do
subject { project_snippets_path(project) }
......
......@@ -6,7 +6,7 @@ RSpec.describe "Private Project Snippets Access" do
include AccessMatchers
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
subject { project_snippets_path(project) }
......
......@@ -6,9 +6,9 @@ RSpec.describe "Public Project Snippets Access" do
include AccessMatchers
let_it_be(:project) { create(:project, :public) }
let_it_be(:public_snippet) { create(:project_snippet, :public, project: project, author: project.owner) }
let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, 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.first_owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.first_owner) }
describe "GET /:project_path/snippets" do
subject { project_snippets_path(project) }
......
......@@ -6,7 +6,7 @@ RSpec.describe ProductivityAnalyticsFinder do
subject { described_class.new(current_user, search_params.merge(state: :merged)) }
let(:project) { create(:project) }
let(:current_user) { project.owner }
let(:current_user) { project.first_owner }
let(:search_params) { {} }
describe '.array_params' do
......
......@@ -6,7 +6,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures in EE co
include JavaScriptFixturesHelpers
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) }
render_views
......
......@@ -10,7 +10,7 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do
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(:user) { project.owner }
let(:user) { project.first_owner }
describe GraphQL::Query, type: :request do
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