diff options
Diffstat (limited to 'spec')
503 files changed, 2719 insertions, 2214 deletions
diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb index fb6d82d7de3..2c59d1929a1 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -228,12 +228,12 @@ describe AutocompleteController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end context 'authorized projects' do before do - authorized_project.add_master(user) + authorized_project.add_maintainer(user) end describe 'GET #projects with project ID' do @@ -253,8 +253,8 @@ describe AutocompleteController do context 'authorized projects and search' do before do - authorized_project.add_master(user) - authorized_search_project.add_master(user) + authorized_project.add_maintainer(user) + authorized_search_project.add_maintainer(user) end describe 'GET #projects with project ID and search' do @@ -277,9 +277,9 @@ describe AutocompleteController do authorized_project2 = create(:project) authorized_project3 = create(:project) - authorized_project.add_master(user) - authorized_project2.add_master(user) - authorized_project3.add_master(user) + authorized_project.add_maintainer(user) + authorized_project2.add_maintainer(user) + authorized_project3.add_maintainer(user) stub_const 'MoveToProjectFinder::PAGE_SIZE', 2 end @@ -301,9 +301,9 @@ describe AutocompleteController do authorized_project2 = create(:project) authorized_project3 = create(:project) - authorized_project.add_master(user) - authorized_project2.add_master(user) - authorized_project3.add_master(user) + authorized_project.add_maintainer(user) + authorized_project2.add_maintainer(user) + authorized_project3.add_maintainer(user) end describe 'GET #projects with project ID and offset_id' do diff --git a/spec/controllers/boards/issues_controller_spec.rb b/spec/controllers/boards/issues_controller_spec.rb index e47ff8661a2..ce7762691c9 100644 --- a/spec/controllers/boards/issues_controller_spec.rb +++ b/spec/controllers/boards/issues_controller_spec.rb @@ -13,7 +13,7 @@ describe Boards::IssuesController do let!(:list2) { create(:list, board: board, label: development, position: 1) } before do - project.add_master(user) + project.add_maintainer(user) project.add_guest(guest) end diff --git a/spec/controllers/boards/lists_controller_spec.rb b/spec/controllers/boards/lists_controller_spec.rb index 57ccbf1d6b5..80631d2efb0 100644 --- a/spec/controllers/boards/lists_controller_spec.rb +++ b/spec/controllers/boards/lists_controller_spec.rb @@ -7,7 +7,7 @@ describe Boards::ListsController do let(:guest) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) project.add_guest(guest) end diff --git a/spec/controllers/dashboard/groups_controller_spec.rb b/spec/controllers/dashboard/groups_controller_spec.rb index 7f2eaf95165..9068c1a792e 100644 --- a/spec/controllers/dashboard/groups_controller_spec.rb +++ b/spec/controllers/dashboard/groups_controller_spec.rb @@ -28,8 +28,8 @@ describe Dashboard::GroupsController do let!(:other_group) { create(:group, name: 'other') } before do - top_level_result.add_master(user) - top_level_a.add_master(user) + top_level_result.add_maintainer(user) + top_level_a.add_maintainer(user) end it 'renders only groups the user is a member of when searching hierarchy correctly' do diff --git a/spec/controllers/dashboard/milestones_controller_spec.rb b/spec/controllers/dashboard/milestones_controller_spec.rb index 60547db82b6..ba2669a5ea7 100644 --- a/spec/controllers/dashboard/milestones_controller_spec.rb +++ b/spec/controllers/dashboard/milestones_controller_spec.rb @@ -17,7 +17,7 @@ describe Dashboard::MilestonesController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'milestone tabs' diff --git a/spec/controllers/dashboard_controller_spec.rb b/spec/controllers/dashboard_controller_spec.rb index 3458d679107..187542ba30c 100644 --- a/spec/controllers/dashboard_controller_spec.rb +++ b/spec/controllers/dashboard_controller_spec.rb @@ -5,7 +5,7 @@ describe DashboardController do let(:project) { create(:project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/groups/boards_controller_spec.rb b/spec/controllers/groups/boards_controller_spec.rb index 0f5bde62006..bf41aa0706f 100644 --- a/spec/controllers/groups/boards_controller_spec.rb +++ b/spec/controllers/groups/boards_controller_spec.rb @@ -5,7 +5,7 @@ describe Groups::BoardsController do let(:user) { create(:user) } before do - group.add_master(user) + group.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/groups/milestones_controller_spec.rb b/spec/controllers/groups/milestones_controller_spec.rb index 733386500ca..f7068546093 100644 --- a/spec/controllers/groups/milestones_controller_spec.rb +++ b/spec/controllers/groups/milestones_controller_spec.rb @@ -28,7 +28,7 @@ describe Groups::MilestonesController do before do sign_in(user) group.add_owner(user) - project.add_master(user) + project.add_maintainer(user) end describe '#index' do diff --git a/spec/controllers/groups/runners_controller_spec.rb b/spec/controllers/groups/runners_controller_spec.rb index 5770d15557c..598fb84552f 100644 --- a/spec/controllers/groups/runners_controller_spec.rb +++ b/spec/controllers/groups/runners_controller_spec.rb @@ -14,7 +14,7 @@ describe Groups::RunnersController do before do sign_in(user) - group.add_master(user) + group.add_maintainer(user) end describe '#update' do diff --git a/spec/controllers/groups/settings/ci_cd_controller_spec.rb b/spec/controllers/groups/settings/ci_cd_controller_spec.rb index e9f0924caba..ea18122e0c3 100644 --- a/spec/controllers/groups/settings/ci_cd_controller_spec.rb +++ b/spec/controllers/groups/settings/ci_cd_controller_spec.rb @@ -5,7 +5,7 @@ describe Groups::Settings::CiCdController do let(:user) { create(:user) } before do - group.add_master(user) + group.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/groups/variables_controller_spec.rb b/spec/controllers/groups/variables_controller_spec.rb index 39a36b92bb4..e5ac5634f95 100644 --- a/spec/controllers/groups/variables_controller_spec.rb +++ b/spec/controllers/groups/variables_controller_spec.rb @@ -6,7 +6,7 @@ describe Groups::VariablesController do before do sign_in(user) - group.add_master(user) + group.add_maintainer(user) end describe 'GET #show' do diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 8688fb33f0d..7a037828035 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -7,7 +7,7 @@ describe GroupsController do let(:project) { create(:project, namespace: group) } let!(:group_member) { create(:group_member, group: group, user: user) } let!(:owner) { group.add_owner(create(:user)).user } - let!(:master) { group.add_master(create(:user)).user } + let!(:maintainer) { group.add_maintainer(create(:user)).user } let!(:developer) { group.add_developer(create(:user)).user } let!(:guest) { group.add_guest(create(:user)).user } @@ -62,7 +62,7 @@ describe GroupsController do [true, false].each do |can_create_group_status| context "and can_create_group is #{can_create_group_status}" do before do - User.where(id: [admin, owner, master, developer, guest]).update_all(can_create_group: can_create_group_status) + User.where(id: [admin, owner, maintainer, developer, guest]).update_all(can_create_group: can_create_group_status) end [:admin, :owner].each do |member_type| @@ -73,7 +73,7 @@ describe GroupsController do end end - [:guest, :developer, :master].each do |member_type| + [:guest, :developer, :maintainer].each do |member_type| context "and logged in as #{member_type.capitalize}" do it_behaves_like 'member without ability to create subgroups' do let(:member) { send(member_type) } diff --git a/spec/controllers/projects/avatars_controller_spec.rb b/spec/controllers/projects/avatars_controller_spec.rb index acfa2730d94..17c9a61f339 100644 --- a/spec/controllers/projects/avatars_controller_spec.rb +++ b/spec/controllers/projects/avatars_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::AvatarsController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) controller.instance_variable_set(:@project, project) end diff --git a/spec/controllers/projects/badges_controller_spec.rb b/spec/controllers/projects/badges_controller_spec.rb index e7cddf8cfbf..dfe34171b55 100644 --- a/spec/controllers/projects/badges_controller_spec.rb +++ b/spec/controllers/projects/badges_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::BadgesController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/blame_controller_spec.rb b/spec/controllers/projects/blame_controller_spec.rb index 88d4f4e9cd0..fe4c4863717 100644 --- a/spec/controllers/projects/blame_controller_spec.rb +++ b/spec/controllers/projects/blame_controller_spec.rb @@ -7,7 +7,7 @@ describe Projects::BlameController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) controller.instance_variable_set(:@project, project) end diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index 4dcb7dc6c87..32cd7c6e70a 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -108,7 +108,7 @@ describe Projects::BlobController do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -230,12 +230,12 @@ describe Projects::BlobController do end end - context 'as master' do - let(:master) { create(:user) } + context 'as maintainer' do + let(:maintainer) { create(:user) } before do - project.add_master(master) - sign_in(master) + project.add_maintainer(maintainer) + sign_in(maintainer) get :edit, default_params end @@ -263,7 +263,7 @@ describe Projects::BlobController do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/boards_controller_spec.rb b/spec/controllers/projects/boards_controller_spec.rb index 509f19ed030..096efc1c7b2 100644 --- a/spec/controllers/projects/boards_controller_spec.rb +++ b/spec/controllers/projects/boards_controller_spec.rb @@ -5,7 +5,7 @@ describe Projects::BoardsController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb index 4860ea5dcce..31471cde420 100644 --- a/spec/controllers/projects/branches_controller_spec.rb +++ b/spec/controllers/projects/branches_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::BranchesController do let(:developer) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user) allow(project).to receive(:branches).and_return(['master', 'foo/bar/baz']) diff --git a/spec/controllers/projects/clusters/applications_controller_spec.rb b/spec/controllers/projects/clusters/applications_controller_spec.rb index 99fdff5f846..9e17e392d3d 100644 --- a/spec/controllers/projects/clusters/applications_controller_spec.rb +++ b/spec/controllers/projects/clusters/applications_controller_spec.rb @@ -17,7 +17,7 @@ describe Projects::Clusters::ApplicationsController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -70,7 +70,7 @@ describe Projects::Clusters::ApplicationsController do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb index e47ccdc9aea..42917d0d505 100644 --- a/spec/controllers/projects/clusters_controller_spec.rb +++ b/spec/controllers/projects/clusters_controller_spec.rb @@ -11,7 +11,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -61,7 +61,7 @@ describe Projects::ClustersController do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -79,7 +79,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -142,7 +142,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -156,7 +156,7 @@ describe Projects::ClustersController do describe 'security' do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -185,7 +185,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -236,7 +236,7 @@ describe Projects::ClustersController do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -267,7 +267,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -286,7 +286,7 @@ describe Projects::ClustersController do describe 'security' do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -306,7 +306,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -327,7 +327,7 @@ describe Projects::ClustersController do describe 'security' do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -350,7 +350,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -365,7 +365,7 @@ describe Projects::ClustersController do describe 'security' do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -386,7 +386,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -437,7 +437,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -525,7 +525,7 @@ describe Projects::ClustersController do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -552,7 +552,7 @@ describe Projects::ClustersController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -605,7 +605,7 @@ describe Projects::ClustersController do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb index 003fec8ac68..916a4be2567 100644 --- a/spec/controllers/projects/commit_controller_spec.rb +++ b/spec/controllers/projects/commit_controller_spec.rb @@ -9,7 +9,7 @@ describe Projects::CommitController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe 'GET show' do diff --git a/spec/controllers/projects/commits_controller_spec.rb b/spec/controllers/projects/commits_controller_spec.rb index 55ed276f96b..d44048fdf55 100644 --- a/spec/controllers/projects/commits_controller_spec.rb +++ b/spec/controllers/projects/commits_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::CommitsController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe "GET show" do diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb index b15cde4314e..8695aa826bb 100644 --- a/spec/controllers/projects/compare_controller_spec.rb +++ b/spec/controllers/projects/compare_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::CompareController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe 'GET index' do diff --git a/spec/controllers/projects/cycle_analytics_controller_spec.rb b/spec/controllers/projects/cycle_analytics_controller_spec.rb index 5516c95d044..5c79269e8f1 100644 --- a/spec/controllers/projects/cycle_analytics_controller_spec.rb +++ b/spec/controllers/projects/cycle_analytics_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::CycleAnalyticsController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe 'cycle analytics not set up flag' do diff --git a/spec/controllers/projects/deploy_keys_controller_spec.rb b/spec/controllers/projects/deploy_keys_controller_spec.rb index 97db69427e9..d2f133f972a 100644 --- a/spec/controllers/projects/deploy_keys_controller_spec.rb +++ b/spec/controllers/projects/deploy_keys_controller_spec.rb @@ -5,7 +5,7 @@ describe Projects::DeployKeysController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/deployments_controller_spec.rb b/spec/controllers/projects/deployments_controller_spec.rb index 6c67dfde63a..d1c960e895d 100644 --- a/spec/controllers/projects/deployments_controller_spec.rb +++ b/spec/controllers/projects/deployments_controller_spec.rb @@ -8,7 +8,7 @@ describe Projects::DeploymentsController do let(:environment) { create(:environment, name: 'production', project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/environments_controller_spec.rb b/spec/controllers/projects/environments_controller_spec.rb index 63cef579864..b86029a4baf 100644 --- a/spec/controllers/projects/environments_controller_spec.rb +++ b/spec/controllers/projects/environments_controller_spec.rb @@ -9,7 +9,7 @@ describe Projects::EnvironmentsController do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/find_file_controller_spec.rb b/spec/controllers/projects/find_file_controller_spec.rb index 505fe82851a..66fe41108e2 100644 --- a/spec/controllers/projects/find_file_controller_spec.rb +++ b/spec/controllers/projects/find_file_controller_spec.rb @@ -7,7 +7,7 @@ describe Projects::FindFileController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) controller.instance_variable_set(:@project, project) end diff --git a/spec/controllers/projects/graphs_controller_spec.rb b/spec/controllers/projects/graphs_controller_spec.rb index c3605555fe7..da78592a6f6 100644 --- a/spec/controllers/projects/graphs_controller_spec.rb +++ b/spec/controllers/projects/graphs_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::GraphsController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe 'GET languages' do diff --git a/spec/controllers/projects/group_links_controller_spec.rb b/spec/controllers/projects/group_links_controller_spec.rb index 78c6f7839b4..879aff26deb 100644 --- a/spec/controllers/projects/group_links_controller_spec.rb +++ b/spec/controllers/projects/group_links_controller_spec.rb @@ -7,7 +7,7 @@ describe Projects::GroupLinksController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/hooks_controller_spec.rb b/spec/controllers/projects/hooks_controller_spec.rb index 2d473d5bf52..0f3033b0933 100644 --- a/spec/controllers/projects/hooks_controller_spec.rb +++ b/spec/controllers/projects/hooks_controller_spec.rb @@ -5,7 +5,7 @@ describe Projects::HooksController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/imports_controller_spec.rb b/spec/controllers/projects/imports_controller_spec.rb index 6f06210f3de..adf3c78ae51 100644 --- a/spec/controllers/projects/imports_controller_spec.rb +++ b/spec/controllers/projects/imports_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::ImportsController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe 'GET #show' do diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 3a41f0fc07a..ff1835a34c2 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -695,7 +695,7 @@ describe Projects::IssuesController do let(:project) { merge_request.source_project } before do - project.add_master(user) + project.add_maintainer(user) sign_in user end @@ -869,7 +869,7 @@ describe Projects::IssuesController do def post_spam admin = create(:admin) create(:user_agent_detail, subject: issue) - project.add_master(admin) + project.add_maintainer(admin) sign_in(admin) post :mark_as_spam, { namespace_id: project.namespace, diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb index e6332a10265..1aca44c6e74 100644 --- a/spec/controllers/projects/jobs_controller_spec.rb +++ b/spec/controllers/projects/jobs_controller_spec.rb @@ -216,17 +216,19 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do end context 'when trace artifact is in ObjectStorage' do + let(:url) { 'http://object-storage/trace' } + let(:file_path) { expand_fixture_path('trace/sample_trace') } let!(:job) { create(:ci_build, :success, :trace_artifact, pipeline: pipeline) } before do allow_any_instance_of(JobArtifactUploader).to receive(:file_storage?) { false } - allow_any_instance_of(JobArtifactUploader).to receive(:url) { remote_trace_url } - allow_any_instance_of(JobArtifactUploader).to receive(:size) { remote_trace_size } + allow_any_instance_of(JobArtifactUploader).to receive(:url) { url } + allow_any_instance_of(JobArtifactUploader).to receive(:size) { File.size(file_path) } end context 'when there are no network issues' do before do - stub_remote_trace_206 + stub_remote_url_206(url, file_path) get_trace end @@ -241,11 +243,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do context 'when there is a network issue' do before do - stub_remote_trace_500 + stub_remote_url_500(url) end it 'returns a trace' do - expect { get_trace }.to raise_error(Gitlab::Ci::Trace::HttpIO::FailedToGetChunkError) + expect { get_trace }.to raise_error(Gitlab::HttpIO::FailedToGetChunkError) end end end @@ -429,7 +431,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do end describe 'POST erase' do - let(:role) { :master } + let(:role) { :maintainer } before do project.add_role(user, role) diff --git a/spec/controllers/projects/labels_controller_spec.rb b/spec/controllers/projects/labels_controller_spec.rb index 452d7e23983..273702e6d21 100644 --- a/spec/controllers/projects/labels_controller_spec.rb +++ b/spec/controllers/projects/labels_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::LabelsController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/mattermosts_controller_spec.rb b/spec/controllers/projects/mattermosts_controller_spec.rb index c5ac0be27bb..c2a334a849c 100644 --- a/spec/controllers/projects/mattermosts_controller_spec.rb +++ b/spec/controllers/projects/mattermosts_controller_spec.rb @@ -5,7 +5,7 @@ describe Projects::MattermostsController do let!(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/merge_requests/creations_controller_spec.rb b/spec/controllers/projects/merge_requests/creations_controller_spec.rb index 00d76f3c39a..d8995f98575 100644 --- a/spec/controllers/projects/merge_requests/creations_controller_spec.rb +++ b/spec/controllers/projects/merge_requests/creations_controller_spec.rb @@ -16,7 +16,7 @@ describe Projects::MergeRequests::CreationsController do end before do - fork_project.add_master(user) + fork_project.add_maintainer(user) Projects::ForkService.new(project, user).execute(fork_project) sign_in(user) end @@ -94,7 +94,7 @@ describe Projects::MergeRequests::CreationsController do let(:other_project) { create(:project, :repository) } before do - other_project.add_master(user) + other_project.add_maintainer(user) end context 'when the path exists in the diff' do diff --git a/spec/controllers/projects/merge_requests/diffs_controller_spec.rb b/spec/controllers/projects/merge_requests/diffs_controller_spec.rb index ec82b35f227..9dc06436c72 100644 --- a/spec/controllers/projects/merge_requests/diffs_controller_spec.rb +++ b/spec/controllers/projects/merge_requests/diffs_controller_spec.rb @@ -140,7 +140,7 @@ describe Projects::MergeRequests::DiffsController do let(:other_project) { create(:project) } before do - other_project.add_master(user) + other_project.add_maintainer(user) diff_for_path(old_path: existing_path, new_path: existing_path, project_id: other_project) end diff --git a/spec/controllers/projects/milestones_controller_spec.rb b/spec/controllers/projects/milestones_controller_spec.rb index b1d83246238..ea906cf7f32 100644 --- a/spec/controllers/projects/milestones_controller_spec.rb +++ b/spec/controllers/projects/milestones_controller_spec.rb @@ -11,7 +11,7 @@ describe Projects::MilestonesController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) controller.instance_variable_set(:@project, project) end diff --git a/spec/controllers/projects/pages_controller_spec.rb b/spec/controllers/projects/pages_controller_spec.rb index 8d2fa6a1740..927b6e0c473 100644 --- a/spec/controllers/projects/pages_controller_spec.rb +++ b/spec/controllers/projects/pages_controller_spec.rb @@ -14,7 +14,7 @@ describe Projects::PagesController do before do allow(Gitlab.config.pages).to receive(:enabled).and_return(true) sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe 'GET show' do diff --git a/spec/controllers/projects/pages_domains_controller_spec.rb b/spec/controllers/projects/pages_domains_controller_spec.rb index d4058a5c515..75871eab1ab 100644 --- a/spec/controllers/projects/pages_domains_controller_spec.rb +++ b/spec/controllers/projects/pages_domains_controller_spec.rb @@ -19,7 +19,7 @@ describe Projects::PagesDomainsController do before do allow(Gitlab.config.pages).to receive(:enabled).and_return(true) sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe 'GET show' do diff --git a/spec/controllers/projects/pipeline_schedules_controller_spec.rb b/spec/controllers/projects/pipeline_schedules_controller_spec.rb index 4cdaa54e0bc..7179423dde2 100644 --- a/spec/controllers/projects/pipeline_schedules_controller_spec.rb +++ b/spec/controllers/projects/pipeline_schedules_controller_spec.rb @@ -121,7 +121,7 @@ describe Projects::PipelineSchedulesController do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:developer).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -274,7 +274,7 @@ describe Projects::PipelineSchedulesController do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:developer).of(project).own(pipeline_schedule) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -292,19 +292,19 @@ describe Projects::PipelineSchedulesController do it { expect { go }.to be_allowed_for(developer_1) } it { expect { go }.to be_denied_for(:developer).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } end - context 'when a master created a pipeline schedule' do - let(:master_1) { create(:user) } - let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: master_1) } + context 'when a maintainer created a pipeline schedule' do + let(:maintainer_1) { create(:user) } + let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: maintainer_1) } before do - project.add_master(master_1) + project.add_maintainer(maintainer_1) end - it { expect { go }.to be_allowed_for(master_1) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(maintainer_1) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) } end end @@ -331,7 +331,7 @@ describe Projects::PipelineSchedulesController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -346,7 +346,7 @@ describe Projects::PipelineSchedulesController do describe 'security' do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:developer).of(project).own(pipeline_schedule) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -364,7 +364,7 @@ describe Projects::PipelineSchedulesController do describe 'security' do it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:owner).of(project) } - it { expect { go }.to be_allowed_for(:master).of(project) } + it { expect { go }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:developer).of(project).own(pipeline_schedule) } it { expect { go }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) } @@ -453,9 +453,9 @@ describe Projects::PipelineSchedulesController do end end - context 'when a master makes the request' do + context 'when a maintainer makes the request' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/pipelines_settings_controller_spec.rb b/spec/controllers/projects/pipelines_settings_controller_spec.rb index 694896b6bcf..b1ba9f74e38 100644 --- a/spec/controllers/projects/pipelines_settings_controller_spec.rb +++ b/spec/controllers/projects/pipelines_settings_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::PipelinesSettingsController do let(:project) { project_auto_devops.project } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/project_members_controller_spec.rb b/spec/controllers/projects/project_members_controller_spec.rb index d84b31ad978..519af10d78c 100644 --- a/spec/controllers/projects/project_members_controller_spec.rb +++ b/spec/controllers/projects/project_members_controller_spec.rb @@ -37,7 +37,7 @@ describe Projects::ProjectMembersController do context 'when user has enough rights' do before do - project.add_master(user) + project.add_maintainer(user) end it 'adds user to members' do @@ -70,7 +70,7 @@ describe Projects::ProjectMembersController do let(:requester) { create(:project_member, :access_request, project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -121,7 +121,7 @@ describe Projects::ProjectMembersController do context 'when user has enough rights' do before do - project.add_master(user) + project.add_maintainer(user) end it '[HTML] removes user from members' do @@ -181,7 +181,7 @@ describe Projects::ProjectMembersController do let(:project) { create(:project, namespace: user.namespace) } before do - project.add_master(user) + project.add_maintainer(user) end it 'cannot remove themselves from the project' do @@ -263,7 +263,7 @@ describe Projects::ProjectMembersController do context 'when user has enough rights' do before do - project.add_master(user) + project.add_maintainer(user) end it 'adds user to members' do @@ -285,7 +285,7 @@ describe Projects::ProjectMembersController do let(:member) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) another_project.add_guest(member) sign_in(user) end @@ -332,7 +332,7 @@ describe Projects::ProjectMembersController do context 'when creating owner' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -346,9 +346,9 @@ describe Projects::ProjectMembersController do end end - context 'when create master' do + context 'when create maintainer' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -356,7 +356,7 @@ describe Projects::ProjectMembersController do expect do post :create, user_ids: stranger.id, namespace_id: project.namespace, - access_level: Member::MASTER, + access_level: Member::MAINTAINER, project_id: project end.to change { project.members.count }.by(1) end diff --git a/spec/controllers/projects/prometheus/metrics_controller_spec.rb b/spec/controllers/projects/prometheus/metrics_controller_spec.rb index 871dcf5c796..5c56a712245 100644 --- a/spec/controllers/projects/prometheus/metrics_controller_spec.rb +++ b/spec/controllers/projects/prometheus/metrics_controller_spec.rb @@ -7,7 +7,7 @@ describe Projects::Prometheus::MetricsController do let(:prometheus_adapter) { double('prometheus_adapter', can_query?: true) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/protected_branches_controller_spec.rb b/spec/controllers/projects/protected_branches_controller_spec.rb index 096e29bc39f..ac812707e74 100644 --- a/spec/controllers/projects/protected_branches_controller_spec.rb +++ b/spec/controllers/projects/protected_branches_controller_spec.rb @@ -8,7 +8,7 @@ describe Projects::ProtectedBranchesController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) end describe "GET #index" do @@ -20,10 +20,10 @@ describe Projects::ProtectedBranchesController do end describe "POST #create" do - let(:master_access_level) { [{ access_level: Gitlab::Access::MASTER }] } + let(:maintainer_access_level) { [{ access_level: Gitlab::Access::MAINTAINER }] } let(:access_level_params) do - { merge_access_levels_attributes: master_access_level, - push_access_levels_attributes: master_access_level } + { merge_access_levels_attributes: maintainer_access_level, + push_access_levels_attributes: maintainer_access_level } end let(:create_params) { attributes_for(:protected_branch).merge(access_level_params) } diff --git a/spec/controllers/projects/protected_tags_controller_spec.rb b/spec/controllers/projects/protected_tags_controller_spec.rb index b6de90039f3..20440c5a5d5 100644 --- a/spec/controllers/projects/protected_tags_controller_spec.rb +++ b/spec/controllers/projects/protected_tags_controller_spec.rb @@ -15,7 +15,7 @@ describe Projects::ProtectedTagsController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/runners_controller_spec.rb b/spec/controllers/projects/runners_controller_spec.rb index 2082dd2cff0..b1e0b496ede 100644 --- a/spec/controllers/projects/runners_controller_spec.rb +++ b/spec/controllers/projects/runners_controller_spec.rb @@ -15,7 +15,7 @@ describe Projects::RunnersController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe '#update' do diff --git a/spec/controllers/projects/services_controller_spec.rb b/spec/controllers/projects/services_controller_spec.rb index 61f35cf325b..45cea8c1351 100644 --- a/spec/controllers/projects/services_controller_spec.rb +++ b/spec/controllers/projects/services_controller_spec.rb @@ -9,7 +9,7 @@ describe Projects::ServicesController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe '#test' do diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb index d53fe9bf734..1f14a0cc381 100644 --- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb +++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::Settings::CiCdController do let(:project) { project_auto_devops.project } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -27,7 +27,7 @@ describe Projects::Settings::CiCdController do let!(:shared_runner) { create(:ci_runner, :instance) } it 'sets assignable project runners only' do - group.add_master(user) + group.add_maintainer(user) get :show, namespace_id: project.namespace, project_id: project @@ -40,7 +40,7 @@ describe Projects::Settings::CiCdController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(true) end diff --git a/spec/controllers/projects/settings/integrations_controller_spec.rb b/spec/controllers/projects/settings/integrations_controller_spec.rb index 77df9a6f567..a2484c04c7a 100644 --- a/spec/controllers/projects/settings/integrations_controller_spec.rb +++ b/spec/controllers/projects/settings/integrations_controller_spec.rb @@ -5,7 +5,7 @@ describe Projects::Settings::IntegrationsController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/settings/repository_controller_spec.rb b/spec/controllers/projects/settings/repository_controller_spec.rb index 3a4014b7768..9cee40b7553 100644 --- a/spec/controllers/projects/settings/repository_controller_spec.rb +++ b/spec/controllers/projects/settings/repository_controller_spec.rb @@ -5,7 +5,7 @@ describe Projects::Settings::RepositoryController do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/controllers/projects/snippets_controller_spec.rb b/spec/controllers/projects/snippets_controller_spec.rb index e7c0b484ede..9c383bd7628 100644 --- a/spec/controllers/projects/snippets_controller_spec.rb +++ b/spec/controllers/projects/snippets_controller_spec.rb @@ -6,8 +6,8 @@ describe Projects::SnippetsController do let(:user2) { create(:user) } before do - project.add_master(user) - project.add_master(user2) + project.add_maintainer(user) + project.add_maintainer(user2) end describe 'GET #index' do @@ -291,7 +291,7 @@ describe Projects::SnippetsController do def mark_as_spam admin = create(:admin) create(:user_agent_detail, subject: snippet) - project.add_master(admin) + project.add_maintainer(admin) sign_in(admin) post :mark_as_spam, diff --git a/spec/controllers/projects/templates_controller_spec.rb b/spec/controllers/projects/templates_controller_spec.rb index 8fcfa3c9ecd..d7f07aa2b01 100644 --- a/spec/controllers/projects/templates_controller_spec.rb +++ b/spec/controllers/projects/templates_controller_spec.rb @@ -13,7 +13,7 @@ describe Projects::TemplatesController do end before do - project.add_user(user, Gitlab::Access::MASTER) + project.add_user(user, Gitlab::Access::MAINTAINER) project.repository.create_file(user, file_path_1, 'something valid', message: 'test 3', branch_name: 'master') end diff --git a/spec/controllers/projects/tree_controller_spec.rb b/spec/controllers/projects/tree_controller_spec.rb index d3188f054cf..9982b49eebb 100644 --- a/spec/controllers/projects/tree_controller_spec.rb +++ b/spec/controllers/projects/tree_controller_spec.rb @@ -7,7 +7,7 @@ describe Projects::TreeController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) controller.instance_variable_set(:@project, project) end diff --git a/spec/controllers/projects/variables_controller_spec.rb b/spec/controllers/projects/variables_controller_spec.rb index 68019743be0..9afd1f751c6 100644 --- a/spec/controllers/projects/variables_controller_spec.rb +++ b/spec/controllers/projects/variables_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::VariablesController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe 'GET #show' do diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index fd7d867f9e5..94644b1f9fd 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -759,7 +759,7 @@ describe ProjectsController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end context 'when project export is enabled' do @@ -787,7 +787,7 @@ describe ProjectsController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end context 'object storage disabled' do @@ -847,7 +847,7 @@ describe ProjectsController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end context 'when project export is enabled' do @@ -875,7 +875,7 @@ describe ProjectsController do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end context 'when project export is enabled' do diff --git a/spec/controllers/uploads_controller_spec.rb b/spec/controllers/uploads_controller_spec.rb index eb94d395a9e..bcf289f36a9 100644 --- a/spec/controllers/uploads_controller_spec.rb +++ b/spec/controllers/uploads_controller_spec.rb @@ -269,13 +269,13 @@ describe UploadsController do context "when the user has access to the project" do before do - project.add_master(user) + project.add_maintainer(user) end context "when the user is blocked" do before do user.block - project.add_master(user) + project.add_maintainer(user) end it "redirects to the sign in page" do @@ -475,13 +475,13 @@ describe UploadsController do context "when the user has access to the project" do before do - project.add_master(user) + project.add_maintainer(user) end context "when the user is blocked" do before do user.block - project.add_master(user) + project.add_maintainer(user) end it "redirects to the sign in page" do diff --git a/spec/factories/group_members.rb b/spec/factories/group_members.rb index 1c2214e9481..47036560b9d 100644 --- a/spec/factories/group_members.rb +++ b/spec/factories/group_members.rb @@ -7,7 +7,7 @@ FactoryBot.define do trait(:guest) { access_level GroupMember::GUEST } trait(:reporter) { access_level GroupMember::REPORTER } trait(:developer) { access_level GroupMember::DEVELOPER } - trait(:master) { access_level GroupMember::MASTER } + trait(:maintainer) { access_level GroupMember::MAINTAINER } trait(:owner) { access_level GroupMember::OWNER } trait(:access_request) { requested_at Time.now } diff --git a/spec/factories/project_members.rb b/spec/factories/project_members.rb index 4260f52498d..22a8085ea45 100644 --- a/spec/factories/project_members.rb +++ b/spec/factories/project_members.rb @@ -2,12 +2,12 @@ FactoryBot.define do factory :project_member do user project - master + maintainer trait(:guest) { access_level ProjectMember::GUEST } trait(:reporter) { access_level ProjectMember::REPORTER } trait(:developer) { access_level ProjectMember::DEVELOPER } - trait(:master) { access_level ProjectMember::MASTER } + trait(:maintainer) { access_level ProjectMember::MAINTAINER } trait(:access_request) { requested_at Time.now } trait(:invited) do diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index f77ded23b18..fec1bea2751 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -47,7 +47,7 @@ FactoryBot.define do # user have access to the project. Our specs don't use said service class, # thus we must manually refresh things here. unless project.group || project.pending_delete - project.add_master(project.owner) + project.add_maintainer(project.owner) end project.group&.refresh_members_authorized_projects diff --git a/spec/factories/protected_branches.rb b/spec/factories/protected_branches.rb index 60956511834..5457c0d2a8f 100644 --- a/spec/factories/protected_branches.rb +++ b/spec/factories/protected_branches.rb @@ -39,23 +39,23 @@ FactoryBot.define do end end - trait :masters_can_push do + trait :maintainers_can_push do transient do default_push_level false end after(:build) do |protected_branch| - protected_branch.push_access_levels.new(access_level: Gitlab::Access::MASTER) + protected_branch.push_access_levels.new(access_level: Gitlab::Access::MAINTAINER) end end after(:build) do |protected_branch, evaluator| if evaluator.default_access_level && evaluator.default_push_level - protected_branch.push_access_levels.new(access_level: Gitlab::Access::MASTER) + protected_branch.push_access_levels.new(access_level: Gitlab::Access::MAINTAINER) end if evaluator.default_access_level && evaluator.default_merge_level - protected_branch.merge_access_levels.new(access_level: Gitlab::Access::MASTER) + protected_branch.merge_access_levels.new(access_level: Gitlab::Access::MAINTAINER) end end diff --git a/spec/factories/protected_tags.rb b/spec/factories/protected_tags.rb index df9c8b3cb63..2b81d089549 100644 --- a/spec/factories/protected_tags.rb +++ b/spec/factories/protected_tags.rb @@ -27,19 +27,19 @@ FactoryBot.define do end end - trait :masters_can_create do + trait :maintainers_can_create do transient do default_access_level false end after(:build) do |protected_tag| - protected_tag.create_access_levels.new(access_level: Gitlab::Access::MASTER) + protected_tag.create_access_levels.new(access_level: Gitlab::Access::MAINTAINER) end end after(:build) do |protected_tag, evaluator| if evaluator.default_access_level - protected_tag.create_access_levels.new(access_level: Gitlab::Access::MASTER) + protected_tag.create_access_levels.new(access_level: Gitlab::Access::MAINTAINER) end end end diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index 5b0a53688c2..96dfde2e08c 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -168,7 +168,7 @@ describe 'Admin Groups' do it 'renders shared project' do empty_project = create(:project) empty_project.project_group_links.create!( - group_access: Gitlab::Access::MASTER, + group_access: Gitlab::Access::MAINTAINER, group: group ) diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index 328e8f25f89..d6ee256f5b5 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -88,7 +88,7 @@ describe "Admin::Projects" do describe 'add admin himself to a project' do before do - project.add_master(user) + project.add_maintainer(user) end it 'adds admin a to a project as developer', :js do @@ -110,7 +110,7 @@ describe "Admin::Projects" do describe 'admin remove himself from a project' do before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(current_user) end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 9c6758abe86..a852ca689e7 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -272,6 +272,16 @@ describe 'Admin updates settings' do expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true end + it 'Enable hiding third party offers' do + page.within('.as-third-party-offers') do + check 'Do not display offers from third parties within GitLab' + click_button 'Save changes' + end + + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.hide_third_party_offers).to be true + end + it 'Change Slack Notifications Service template settings' do first(:link, 'Service Templates').click click_link 'Slack notifications' diff --git a/spec/features/atom/dashboard_issues_spec.rb b/spec/features/atom/dashboard_issues_spec.rb index da7749b42d2..bd4c00d97b1 100644 --- a/spec/features/atom/dashboard_issues_spec.rb +++ b/spec/features/atom/dashboard_issues_spec.rb @@ -8,8 +8,8 @@ describe "Dashboard Issues Feed" do let!(:project2) { create(:project) } before do - project1.add_master(user) - project2.add_master(user) + project1.add_maintainer(user) + project2.add_maintainer(user) end describe "atom feed" do diff --git a/spec/features/atom/dashboard_spec.rb b/spec/features/atom/dashboard_spec.rb index 462eab07a75..86b3f88298f 100644 --- a/spec/features/atom/dashboard_spec.rb +++ b/spec/features/atom/dashboard_spec.rb @@ -26,7 +26,7 @@ describe "Dashboard Feed" do let(:note) { create(:note, noteable: issue, author: user, note: 'Bug confirmed', project: project) } before do - project.add_master(user) + project.add_maintainer(user) issue_event(issue, user) note_event(note, user) visit dashboard_projects_path(:atom, feed_token: user.feed_token) diff --git a/spec/features/atom/users_spec.rb b/spec/features/atom/users_spec.rb index eeaaa40fe21..8d7df346abb 100644 --- a/spec/features/atom/users_spec.rb +++ b/spec/features/atom/users_spec.rb @@ -47,7 +47,7 @@ describe "User Feed" do let!(:push_event_payload) { create(:push_event_payload, event: push_event) } before do - project.add_master(user) + project.add_maintainer(user) issue_event(issue, user) note_event(note, user) merge_request_event(merge_request, user) diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index 7a14a441088..eebc987499d 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -12,7 +12,7 @@ describe 'Issue Boards add issue modal', :js do let!(:issue2) { create(:issue, project: project, title: 'hij', description: 'klm') } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index f6e0dee28c6..a0af2dea3ad 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -11,8 +11,8 @@ describe 'Issue Boards', :js do let!(:user2) { create(:user) } before do - project.add_master(user) - project.add_master(user2) + project.add_maintainer(user) + project.add_maintainer(user2) set_cookie('sidebar_collapsed', 'true') diff --git a/spec/features/boards/issue_ordering_spec.rb b/spec/features/boards/issue_ordering_spec.rb index 32bd7b88840..ec0ca21450a 100644 --- a/spec/features/boards/issue_ordering_spec.rb +++ b/spec/features/boards/issue_ordering_spec.rb @@ -13,7 +13,7 @@ describe 'Issue Boards', :js do let!(:issue3) { create(:labeled_issue, project: project, title: 'testing 3', labels: [label], relative_position: 1) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/boards/modal_filter_spec.rb b/spec/features/boards/modal_filter_spec.rb index be9c6a51c29..615223a2a88 100644 --- a/spec/features/boards/modal_filter_spec.rb +++ b/spec/features/boards/modal_filter_spec.rb @@ -10,7 +10,7 @@ describe 'Issue Boards add issue modal filtering', :js do let!(:issue1) { create(:issue, project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/boards/new_issue_spec.rb b/spec/features/boards/new_issue_spec.rb index 7a95f5cf871..0bf1ecbc433 100644 --- a/spec/features/boards/new_issue_spec.rb +++ b/spec/features/boards/new_issue_spec.rb @@ -8,7 +8,7 @@ describe 'Issue Boards new issue', :js do context 'authorized user' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index a03aa681827..ee38e756f9e 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -22,7 +22,7 @@ describe 'Issue Boards', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/boards/sub_group_project_spec.rb b/spec/features/boards/sub_group_project_spec.rb index 271c610dcc8..de2cb4c335e 100644 --- a/spec/features/boards/sub_group_project_spec.rb +++ b/spec/features/boards/sub_group_project_spec.rb @@ -11,7 +11,7 @@ describe 'Sub-group project issue boards', :js do let!(:issue) { create(:labeled_issue, project: project, labels: [label]) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 29fcf89fa7a..8989b2051bb 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -188,7 +188,7 @@ describe 'Commits' do let(:branch_name) { 'master' } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_commits_path(project, branch_name) end diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb index dfcd7ada23b..32c75cae0a1 100644 --- a/spec/features/cycle_analytics_spec.rb +++ b/spec/features/cycle_analytics_spec.rb @@ -12,7 +12,7 @@ describe 'Cycle Analytics', :js do context 'as an allowed user' do context 'when project is new' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) @@ -39,7 +39,7 @@ describe 'Cycle Analytics', :js do context "when there's cycle analytics data" do before do allow_any_instance_of(Gitlab::ReferenceExtractor).to receive(:issues).and_return([issue]) - project.add_master(user) + project.add_maintainer(user) @build = create_cycle(user, project, issue, mr, milestone, pipeline) deploy_master(user, project) @@ -95,7 +95,7 @@ describe 'Cycle Analytics', :js do before do user.update_attribute(:preferred_language, 'es') - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_cycle_analytics_path(project) wait_for_requests diff --git a/spec/features/dashboard/activity_spec.rb b/spec/features/dashboard/activity_spec.rb index 9ed912820f7..bf91dc121d8 100644 --- a/spec/features/dashboard/activity_spec.rb +++ b/spec/features/dashboard/activity_spec.rb @@ -60,7 +60,7 @@ describe 'Dashboard > Activity' do end before do - project.add_master(user) + project.add_maintainer(user) visit activity_dashboard_path wait_for_requests diff --git a/spec/features/dashboard/archived_projects_spec.rb b/spec/features/dashboard/archived_projects_spec.rb index b36231fd78b..6a0cd848345 100644 --- a/spec/features/dashboard/archived_projects_spec.rb +++ b/spec/features/dashboard/archived_projects_spec.rb @@ -6,8 +6,8 @@ RSpec.describe 'Dashboard Archived Project' do let(:archived_project) { create(:project, :archived) } before do - project.add_master(user) - archived_project.add_master(user) + project.add_maintainer(user) + archived_project.add_maintainer(user) sign_in(user) diff --git a/spec/features/dashboard/datetime_on_tooltips_spec.rb b/spec/features/dashboard/datetime_on_tooltips_spec.rb index 28bff4d2821..d7234158fa1 100644 --- a/spec/features/dashboard/datetime_on_tooltips_spec.rb +++ b/spec/features/dashboard/datetime_on_tooltips_spec.rb @@ -8,7 +8,7 @@ describe 'Tooltips on .timeago dates', :js do context 'on the activity tab' do before do - project.add_master(user) + project.add_maintainer(user) Event.create( project: project, author_id: user.id, action: Event::JOINED, updated_at: created_date, created_at: created_date) @@ -27,7 +27,7 @@ describe 'Tooltips on .timeago dates', :js do context 'on the snippets tab' do before do - project.add_master(user) + project.add_maintainer(user) create(:snippet, author: user, updated_at: created_date, created_at: created_date) sign_in user diff --git a/spec/features/dashboard/issues_filter_spec.rb b/spec/features/dashboard/issues_filter_spec.rb index 340262be502..95e2610dd4a 100644 --- a/spec/features/dashboard/issues_filter_spec.rb +++ b/spec/features/dashboard/issues_filter_spec.rb @@ -11,7 +11,7 @@ describe 'Dashboard Issues filtering', :js do let!(:issue2) { create(:issue, project: project, author: user, assignees: [user], milestone: milestone) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit_issues diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 3cc7b38550d..4ae062f242a 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Dashboard Issues' do let!(:other_issue) { create :issue, project: project } before do - [project, project_with_issues_disabled].each { |project| project.add_master(current_user) } + [project, project_with_issues_disabled].each { |project| project.add_maintainer(current_user) } sign_in(current_user) visit issues_dashboard_path(assignee_id: current_user.id) end diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index 46d7a82d468..f51142f5790 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -12,7 +12,7 @@ describe 'Dashboard Merge Requests' do let(:forked_project) { fork_project(public_project, current_user, repository: true) } before do - project.add_master(current_user) + project.add_maintainer(current_user) sign_in(current_user) end @@ -20,7 +20,7 @@ describe 'Dashboard Merge Requests' do let(:project_with_disabled_merge_requests) { create(:project, :merge_requests_disabled) } before do - project_with_disabled_merge_requests.add_master(current_user) + project_with_disabled_merge_requests.add_maintainer(current_user) visit merge_requests_dashboard_path end diff --git a/spec/features/dashboard/milestone_tabs_spec.rb b/spec/features/dashboard/milestone_tabs_spec.rb index 6fcde35f541..21de7c2f06f 100644 --- a/spec/features/dashboard/milestone_tabs_spec.rb +++ b/spec/features/dashboard/milestone_tabs_spec.rb @@ -14,7 +14,7 @@ describe 'Dashboard milestone tabs', :js do let!(:merge_request) { create(:labeled_merge_request, source_project: project, target_project: project, milestone: project_milestone, labels: [label]) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit dashboard_milestone_path(milestone.safe_title, title: milestone.title) diff --git a/spec/features/dashboard/milestones_spec.rb b/spec/features/dashboard/milestones_spec.rb index c0699a72521..0db69432702 100644 --- a/spec/features/dashboard/milestones_spec.rb +++ b/spec/features/dashboard/milestones_spec.rb @@ -16,7 +16,7 @@ describe 'Dashboard > Milestones' do let(:project) { create(:project, namespace: user.namespace) } let!(:milestone) { create(:milestone, project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit dashboard_milestones_path end diff --git a/spec/features/dashboard/project_member_activity_index_spec.rb b/spec/features/dashboard/project_member_activity_index_spec.rb index cfd6329fad0..498775acff3 100644 --- a/spec/features/dashboard/project_member_activity_index_spec.rb +++ b/spec/features/dashboard/project_member_activity_index_spec.rb @@ -5,7 +5,7 @@ describe 'Project member activity', :js do let(:project) { create(:project, :public, name: 'x', namespace: user.namespace) } before do - project.add_master(user) + project.add_maintainer(user) end def visit_activities_and_wait_with_event(event_type) diff --git a/spec/features/dashboard/user_filters_projects_spec.rb b/spec/features/dashboard/user_filters_projects_spec.rb index 92f4d4b854c..3746d37b9cd 100644 --- a/spec/features/dashboard/user_filters_projects_spec.rb +++ b/spec/features/dashboard/user_filters_projects_spec.rb @@ -7,7 +7,7 @@ describe 'Dashboard > User filters projects' do let(:project2) { create(:project, name: 'Treasure', namespace: user2.namespace) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/discussion_comments/commit_spec.rb b/spec/features/discussion_comments/commit_spec.rb index 69d35cdbc72..7a3b1d7ed47 100644 --- a/spec/features/discussion_comments/commit_spec.rb +++ b/spec/features/discussion_comments/commit_spec.rb @@ -8,7 +8,7 @@ describe 'Discussion Comments Commit', :js do let(:merge_request) { create(:merge_request, source_project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_commit_path(project, sample_commit.id) diff --git a/spec/features/discussion_comments/issue_spec.rb b/spec/features/discussion_comments/issue_spec.rb index 9812eaf3420..5ec19460bbd 100644 --- a/spec/features/discussion_comments/issue_spec.rb +++ b/spec/features/discussion_comments/issue_spec.rb @@ -6,7 +6,7 @@ describe 'Discussion Comments Issue', :js do let(:issue) { create(:issue, project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_issue_path(project, issue) diff --git a/spec/features/discussion_comments/merge_request_spec.rb b/spec/features/discussion_comments/merge_request_spec.rb index b0019c32189..f940e973923 100644 --- a/spec/features/discussion_comments/merge_request_spec.rb +++ b/spec/features/discussion_comments/merge_request_spec.rb @@ -6,7 +6,7 @@ describe 'Discussion Comments Merge Request', :js do let(:merge_request) { create(:merge_request, source_project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_merge_request_path(project, merge_request) diff --git a/spec/features/discussion_comments/snippets_spec.rb b/spec/features/discussion_comments/snippets_spec.rb index 4a236c4639b..d330e89505e 100644 --- a/spec/features/discussion_comments/snippets_spec.rb +++ b/spec/features/discussion_comments/snippets_spec.rb @@ -6,7 +6,7 @@ describe 'Discussion Comments Snippet', :js do let(:snippet) { create(:project_snippet, :private, project: project, author: user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_snippet_path(project, snippet) diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb index df64219de99..d7692181453 100644 --- a/spec/features/global_search_spec.rb +++ b/spec/features/global_search_spec.rb @@ -5,7 +5,7 @@ describe 'Global search' do let(:project) { create(:project, namespace: user.namespace) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/group_variables_spec.rb b/spec/features/group_variables_spec.rb index 5643240377b..89e0cdd8ed7 100644 --- a/spec/features/group_variables_spec.rb +++ b/spec/features/group_variables_spec.rb @@ -7,7 +7,7 @@ describe 'Group variables', :js do let(:page_path) { group_settings_ci_cd_path(group) } before do - group.add_master(user) + group.add_maintainer(user) gitlab_sign_in(user) visit page_path diff --git a/spec/features/groups/activity_spec.rb b/spec/features/groups/activity_spec.rb index 27520cf0e22..88fc12ae1e4 100644 --- a/spec/features/groups/activity_spec.rb +++ b/spec/features/groups/activity_spec.rb @@ -23,7 +23,7 @@ describe 'Group activity page' do let(:project) { create(:project, :public, namespace: group) } before do - project.add_master(user) + project.add_maintainer(user) visit path end diff --git a/spec/features/groups/empty_states_spec.rb b/spec/features/groups/empty_states_spec.rb index dd901b034f7..8f5ca781b2c 100644 --- a/spec/features/groups/empty_states_spec.rb +++ b/spec/features/groups/empty_states_spec.rb @@ -19,7 +19,7 @@ describe 'Group empty states' do let(:project) { create(:project, namespace: group) } before do - project.add_master(user) + project.add_maintainer(user) end context "the project has #{issuable_name}s" do diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb index 2bab6aa3d48..97d8776b15a 100644 --- a/spec/features/groups/issues_spec.rb +++ b/spec/features/groups/issues_spec.rb @@ -80,10 +80,10 @@ describe 'Group issues page' do context 'projects with issues disabled' do describe 'issue dropdown' do - let(:user_in_group) { create(:group_member, :master, user: create(:user), group: group ).user } + let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user } before do - [project, project_with_issues_disabled].each { |project| project.add_master(user_in_group) } + [project, project_with_issues_disabled].each { |project| project.add_maintainer(user_in_group) } sign_in(user_in_group) visit issues_group_path(group) end diff --git a/spec/features/groups/members/filter_members_spec.rb b/spec/features/groups/members/filter_members_spec.rb index 8b4f6dbcc50..386d81546d7 100644 --- a/spec/features/groups/members/filter_members_spec.rb +++ b/spec/features/groups/members/filter_members_spec.rb @@ -7,7 +7,7 @@ describe 'Groups > Members > Filter members' do before do group.add_owner(user) - group.add_master(user_with_2fa) + group.add_maintainer(user_with_2fa) sign_in(user) end diff --git a/spec/features/groups/members/master_manages_access_requests_spec.rb b/spec/features/groups/members/master_manages_access_requests_spec.rb index 4fdf1497781..bd615c99412 100644 --- a/spec/features/groups/members/master_manages_access_requests_spec.rb +++ b/spec/features/groups/members/master_manages_access_requests_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe 'Groups > Members > Master manages access requests' do - it_behaves_like 'Master manages access requests' do +describe 'Groups > Members > Maintainer manages access requests' do + it_behaves_like 'Maintainer manages access requests' do let(:entity) { create(:group, :public, :access_requestable) } let(:members_page_path) { group_group_members_path(entity) } end diff --git a/spec/features/groups/milestone_spec.rb b/spec/features/groups/milestone_spec.rb index 5ab03cb6ee6..80df0618a6a 100644 --- a/spec/features/groups/milestone_spec.rb +++ b/spec/features/groups/milestone_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe 'Group milestones' do let(:group) { create(:group) } let!(:project) { create(:project_empty_repo, group: group) } - let(:user) { create(:group_member, :master, user: create(:user), group: group ).user } + let(:user) { create(:group_member, :maintainer, user: create(:user), group: group ).user } around do |example| Timecop.freeze { example.run } diff --git a/spec/features/groups/milestones_sorting_spec.rb b/spec/features/groups/milestones_sorting_spec.rb index 5deb55bc8bb..bc226ff41c1 100644 --- a/spec/features/groups/milestones_sorting_spec.rb +++ b/spec/features/groups/milestones_sorting_spec.rb @@ -9,7 +9,7 @@ describe 'Milestones sorting', :js do let!(:project_milestone2) { create(:milestone, project: project, title: 'v2.0', due_date: 5.days.from_now) } let!(:other_project_milestone2) { create(:milestone, project: other_project, title: 'v2.0', due_date: 5.days.from_now) } let!(:group_milestone) { create(:milestone, group: group, title: 'v3.0', due_date: 7.days.from_now) } - let(:user) { create(:group_member, :master, user: create(:user), group: group ).user } + let(:user) { create(:group_member, :maintainer, user: create(:user), group: group ).user } before do sign_in(user) diff --git a/spec/features/ics/dashboard_issues_spec.rb b/spec/features/ics/dashboard_issues_spec.rb index a4d05c25a90..ea714934ae7 100644 --- a/spec/features/ics/dashboard_issues_spec.rb +++ b/spec/features/ics/dashboard_issues_spec.rb @@ -8,7 +8,7 @@ describe 'Dashboard Issues Calendar Feed' do let(:milestone) { create(:milestone, project_id: project.id, title: 'v1.0') } before do - project.add_master(user) + project.add_maintainer(user) end context 'when authenticated' do diff --git a/spec/features/ide_spec.rb b/spec/features/ide_spec.rb index b3f24c2966d..65989c36c1e 100644 --- a/spec/features/ide_spec.rb +++ b/spec/features/ide_spec.rb @@ -8,7 +8,7 @@ describe 'IDE', :js do let(:subgroup_project) { create(:project, :repository, namespace: subgroup) } before do - subgroup_project.add_master(user) + subgroup_project.add_maintainer(user) sign_in(user) visit project_path(subgroup_project) diff --git a/spec/features/invites_spec.rb b/spec/features/invites_spec.rb index a986ddc4abc..9e1a12a9c2a 100644 --- a/spec/features/invites_spec.rb +++ b/spec/features/invites_spec.rb @@ -8,7 +8,7 @@ describe 'Invites' do let(:group_invite) { group.group_members.invite.last } before do - project.add_master(owner) + project.add_maintainer(owner) group.add_user(owner, Gitlab::Access::OWNER) group.add_developer('user@example.com', owner) group_invite.generate_invite_token! diff --git a/spec/features/issuables/close_reopen_report_toggle_spec.rb b/spec/features/issuables/close_reopen_report_toggle_spec.rb index 3df77a104e8..de6f5fe1560 100644 --- a/spec/features/issuables/close_reopen_report_toggle_spec.rb +++ b/spec/features/issuables/close_reopen_report_toggle_spec.rb @@ -46,7 +46,7 @@ describe 'Issuables Close/Reopen/Report toggle' do let(:issuable) { create(:issue, project: project) } before do - project.add_master(user) + project.add_maintainer(user) login_as user end @@ -83,7 +83,7 @@ describe 'Issuables Close/Reopen/Report toggle' do let(:issuable) { create(:merge_request, source_project: project) } before do - project.add_master(user) + project.add_maintainer(user) login_as user end diff --git a/spec/features/issues/award_emoji_spec.rb b/spec/features/issues/award_emoji_spec.rb index 1131e1711bf..bf60b18873c 100644 --- a/spec/features/issues/award_emoji_spec.rb +++ b/spec/features/issues/award_emoji_spec.rb @@ -11,7 +11,7 @@ describe 'Awards Emoji' do context 'authorized user' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/issues/bulk_assignment_labels_spec.rb b/spec/features/issues/bulk_assignment_labels_spec.rb index 44ddc032656..06cb2e36334 100644 --- a/spec/features/issues/bulk_assignment_labels_spec.rb +++ b/spec/features/issues/bulk_assignment_labels_spec.rb @@ -11,7 +11,7 @@ describe 'Issues > Labels bulk assignment' do context 'as an allowed user', :js do before do - project.add_master(user) + project.add_maintainer(user) sign_in user end diff --git a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb index 32c6ac52f92..ada57285abf 100644 --- a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb @@ -14,7 +14,7 @@ describe 'Resolving all open discussions in a merge request from an issue', :js describe 'as a user with access to the project' do before do - project.add_master(user) + project.add_maintainer(user) sign_in user visit project_merge_request_path(project, merge_request) end diff --git a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb index b8222283a98..b20730bdb22 100644 --- a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb @@ -14,7 +14,7 @@ describe 'Resolve an open discussion in a merge request by creating an issue', : describe 'As a user with access to the project' do before do - project.add_master(user) + project.add_maintainer(user) sign_in user visit project_merge_request_path(project, merge_request) end diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb index c8115db9212..d011d2545bb 100644 --- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb @@ -20,9 +20,9 @@ describe 'Dropdown assignee', :js do end before do - project.add_master(user) - project.add_master(user_john) - project.add_master(user_jacob) + project.add_maintainer(user) + project.add_maintainer(user_john) + project.add_maintainer(user_jacob) sign_in(user) create(:issue, project: project) @@ -224,7 +224,7 @@ describe 'Dropdown assignee', :js do expect(initial_size).to be > 0 new_user = create(:user) - project.add_master(new_user) + project.add_maintainer(new_user) find('.filtered-search-box .clear-search').click input_filtered_search('assignee:', submit: false, extra_space: false) diff --git a/spec/features/issues/filtered_search/dropdown_author_spec.rb b/spec/features/issues/filtered_search/dropdown_author_spec.rb index 70b4f11410d..50d819a6161 100644 --- a/spec/features/issues/filtered_search/dropdown_author_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_author_spec.rb @@ -28,9 +28,9 @@ describe 'Dropdown author', :js do end before do - project.add_master(user) - project.add_master(user_john) - project.add_master(user_jacob) + project.add_maintainer(user) + project.add_maintainer(user_john) + project.add_maintainer(user_jacob) sign_in(user) create(:issue, project: project) @@ -195,7 +195,7 @@ describe 'Dropdown author', :js do expect(initial_size).to be > 0 new_user = create(:user) - project.add_master(new_user) + project.add_maintainer(new_user) find('.filtered-search-box .clear-search').click filtered_search.set('author') send_keys_to_filtered_search(':') diff --git a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb index 436625a6f7b..be229e8aa7d 100644 --- a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb @@ -28,7 +28,7 @@ describe 'Dropdown emoji', :js do end before do - project.add_master(user) + project.add_maintainer(user) create_list(:award_emoji, 2, user: user, name: 'thumbsup') create_list(:award_emoji, 1, user: user, name: 'thumbsdown') create_list(:award_emoji, 3, user: user, name: 'star') diff --git a/spec/features/issues/filtered_search/dropdown_hint_spec.rb b/spec/features/issues/filtered_search/dropdown_hint_spec.rb index ef40dddfd3a..b99c5a7f4e3 100644 --- a/spec/features/issues/filtered_search/dropdown_hint_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_hint_spec.rb @@ -13,7 +13,7 @@ describe 'Dropdown hint', :js do end before do - project.add_master(user) + project.add_maintainer(user) create(:issue, project: project) end diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index 18cdb199c70..ca5d506ab04 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -33,7 +33,7 @@ describe 'Dropdown label', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) create(:issue, project: project) diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb index 94710c2f71f..f76d30056da 100644 --- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb @@ -29,7 +29,7 @@ describe 'Dropdown milestone', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) create(:issue, project: project) diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index 8dca81a8627..d4949de3f27 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -24,7 +24,7 @@ describe 'Filter issues', :js do end before do - project.add_master(user) + project.add_maintainer(user) create(:issue, project: project, author: user2, title: "Bug report 1") create(:issue, project: project, author: user2, title: "Bug report 2") diff --git a/spec/features/issues/filtered_search/search_bar_spec.rb b/spec/features/issues/filtered_search/search_bar_spec.rb index 268590da599..8abab3f35d6 100644 --- a/spec/features/issues/filtered_search/search_bar_spec.rb +++ b/spec/features/issues/filtered_search/search_bar_spec.rb @@ -8,7 +8,7 @@ describe 'Search bar', :js do let(:filtered_search) { find('.filtered-search') } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) create(:issue, project: project) diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index 0ae70c855db..6ac7ccd00f7 100644 --- a/spec/features/issues/filtered_search/visual_tokens_spec.rb +++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb @@ -22,8 +22,8 @@ describe 'Visual tokens', :js do end before do - project.add_user(user, :master) - project.add_user(user_rock, :master) + project.add_user(user, :maintainer) + project.add_user(user_rock, :maintainer) sign_in(user) create(:issue, project: project) diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb index 2cb3ae08b0e..1456a2f0375 100644 --- a/spec/features/issues/form_spec.rb +++ b/spec/features/issues/form_spec.rb @@ -13,8 +13,8 @@ describe 'New/edit issue', :js do let!(:issue) { create(:issue, project: project, assignees: [user], milestone: milestone) } before do - project.add_master(user) - project.add_master(user2) + project.add_maintainer(user) + project.add_maintainer(user2) sign_in(user) end @@ -321,7 +321,7 @@ describe 'New/edit issue', :js do let(:sub_group_project) { create(:project, group: nested_group_1) } before do - sub_group_project.add_master(user) + sub_group_project.add_maintainer(user) visit new_project_issue_path(sub_group_project) end diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index a330ba4c8b3..98e37d8011a 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -7,7 +7,7 @@ describe 'GFM autocomplete', :js do let(:issue) { create(:issue, project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_issue_path(project, issue) diff --git a/spec/features/issues/spam_issues_spec.rb b/spec/features/issues/spam_issues_spec.rb index 73022afbda2..7cce45ff206 100644 --- a/spec/features/issues/spam_issues_spec.rb +++ b/spec/features/issues/spam_issues_spec.rb @@ -17,7 +17,7 @@ describe 'New issue', :js do recaptcha_private_key: 'test private key' ) - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/issues/todo_spec.rb b/spec/features/issues/todo_spec.rb index d23f9059d0f..0114178b9be 100644 --- a/spec/features/issues/todo_spec.rb +++ b/spec/features/issues/todo_spec.rb @@ -6,7 +6,7 @@ describe 'Manually create a todo item from issue', :js do let!(:user) { create(:user)} before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_issue_path(project, issue) end diff --git a/spec/features/issues/update_issues_spec.rb b/spec/features/issues/update_issues_spec.rb index cd6a5977eb8..845a7c5fc42 100644 --- a/spec/features/issues/update_issues_spec.rb +++ b/spec/features/issues/update_issues_spec.rb @@ -6,7 +6,7 @@ describe 'Multiple issue updating from issues#index', :js do let!(:user) { create(:user)} before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/issues/user_uses_slash_commands_spec.rb b/spec/features/issues/user_uses_slash_commands_spec.rb index a28378b22ca..5926e442f24 100644 --- a/spec/features/issues/user_uses_slash_commands_spec.rb +++ b/spec/features/issues/user_uses_slash_commands_spec.rb @@ -12,7 +12,7 @@ describe 'Issues > User uses quick actions', :js do let(:project) { create(:project, :public) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_issue_path(project, issue) end @@ -196,7 +196,7 @@ describe 'Issues > User uses quick actions', :js do let(:target_project) { create(:project, :public) } before do - target_project.add_master(user) + target_project.add_maintainer(user) gitlab_sign_out sign_in(user) visit project_issue_path(project, issue) @@ -258,7 +258,7 @@ describe 'Issues > User uses quick actions', :js do let(:wontfix_target) { create(:label, project: target_project, title: 'wontfix') } before do - target_project.add_master(user) + target_project.add_maintainer(user) gitlab_sign_out sign_in(user) visit project_issue_path(project, issue) diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index c6dcd97631d..4d9b8a10e04 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -398,7 +398,7 @@ describe 'Issues' do before do stub_incoming_email_setting(enabled: true, address: "p+%{key}@gl.ab") - project1.add_master(user) + project1.add_maintainer(user) visit namespace_project_issues_path(user.namespace, project1) end diff --git a/spec/features/markdown/gitlab_flavored_markdown_spec.rb b/spec/features/markdown/gitlab_flavored_markdown_spec.rb index 3c2186b3598..6997ca48427 100644 --- a/spec/features/markdown/gitlab_flavored_markdown_spec.rb +++ b/spec/features/markdown/gitlab_flavored_markdown_spec.rb @@ -6,7 +6,7 @@ describe "GitLab Flavored Markdown" do let(:issue) { create(:issue, project: project) } let(:fred) do create(:user, name: 'fred') do |user| - project.add_master(user) + project.add_maintainer(user) end end diff --git a/spec/features/merge_request/maintainer_edits_fork_spec.rb b/spec/features/merge_request/maintainer_edits_fork_spec.rb index 1808d0c0a0c..7839b97122c 100644 --- a/spec/features/merge_request/maintainer_edits_fork_spec.rb +++ b/spec/features/merge_request/maintainer_edits_fork_spec.rb @@ -18,7 +18,7 @@ describe 'a maintainer edits files on a source-branch of an MR from a fork', :js end before do - target_project.add_master(user) + target_project.add_maintainer(user) sign_in(user) visit project_merge_request_path(target_project, merge_request) diff --git a/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb b/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb index 0af37d76539..0ccab5b2fac 100644 --- a/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb +++ b/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb @@ -71,7 +71,7 @@ describe 'create a merge request, allowing commits from members who can merge to end before do - target_project.add_master(member) + target_project.add_maintainer(member) sign_in(member) end diff --git a/spec/features/merge_request/user_cherry_picks_spec.rb b/spec/features/merge_request/user_cherry_picks_spec.rb index 61d1bdaa95a..c6ec3f08cc5 100644 --- a/spec/features/merge_request/user_cherry_picks_spec.rb +++ b/spec/features/merge_request/user_cherry_picks_spec.rb @@ -7,7 +7,7 @@ describe 'Merge request > User cherry-picks', :js do let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/merge_request/user_customizes_merge_commit_message_spec.rb b/spec/features/merge_request/user_customizes_merge_commit_message_spec.rb index e1e70b6d260..8d2d4279d3c 100644 --- a/spec/features/merge_request/user_customizes_merge_commit_message_spec.rb +++ b/spec/features/merge_request/user_customizes_merge_commit_message_spec.rb @@ -32,7 +32,7 @@ describe 'Merge request < User customizes merge commit message', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_merge_request_path(project, merge_request) end diff --git a/spec/features/merge_request/user_merges_immediately_spec.rb b/spec/features/merge_request/user_merges_immediately_spec.rb index b16fc9bfc89..ea61f9675bc 100644 --- a/spec/features/merge_request/user_merges_immediately_spec.rb +++ b/spec/features/merge_request/user_merges_immediately_spec.rb @@ -19,7 +19,7 @@ describe 'Merge requests > User merges immediately', :js do context 'when there is active pipeline for merge request' do before do create(:ci_build, pipeline: pipeline) - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_merge_request_path(project, merge_request) end diff --git a/spec/features/merge_request/user_merges_only_if_pipeline_succeeds_spec.rb b/spec/features/merge_request/user_merges_only_if_pipeline_succeeds_spec.rb index a045791f6b4..8372b61f872 100644 --- a/spec/features/merge_request/user_merges_only_if_pipeline_succeeds_spec.rb +++ b/spec/features/merge_request/user_merges_only_if_pipeline_succeeds_spec.rb @@ -5,7 +5,7 @@ describe 'Merge request > User merges only if pipeline succeeds', :js do let(:project) { merge_request.target_project } before do - project.add_master(merge_request.author) + project.add_maintainer(merge_request.author) sign_in(merge_request.author) end diff --git a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb index db92a3504f3..53ed5d78598 100644 --- a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb +++ b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb @@ -17,7 +17,7 @@ describe 'Merge request > User merges when pipeline succeeds', :js do end before do - project.add_master(user) + project.add_maintainer(user) end context 'when there is active pipeline for merge request' do diff --git a/spec/features/merge_request/user_posts_notes_spec.rb b/spec/features/merge_request/user_posts_notes_spec.rb index fa819cbc385..260c5f9c28b 100644 --- a/spec/features/merge_request/user_posts_notes_spec.rb +++ b/spec/features/merge_request/user_posts_notes_spec.rb @@ -14,7 +14,7 @@ describe 'Merge request > User posts notes', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_merge_request_path(project, merge_request) end diff --git a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb index a0b9d6cb059..bf4d5396df9 100644 --- a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb +++ b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb @@ -19,7 +19,7 @@ describe 'Merge request > User resolves diff notes and discussions', :js do context 'no discussions' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) note.destroy visit_merge_request @@ -33,7 +33,7 @@ describe 'Merge request > User resolves diff notes and discussions', :js do context 'as authorized user' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit_merge_request end diff --git a/spec/features/merge_request/user_sees_avatar_on_diff_notes_spec.rb b/spec/features/merge_request/user_sees_avatar_on_diff_notes_spec.rb index 0a8296bd722..428eb414274 100644 --- a/spec/features/merge_request/user_sees_avatar_on_diff_notes_spec.rb +++ b/spec/features/merge_request/user_sees_avatar_on_diff_notes_spec.rb @@ -19,7 +19,7 @@ describe 'Merge request > User sees avatars on diff notes', :js do let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request, position: position) } before do - project.add_master(user) + project.add_maintainer(user) sign_in user set_cookie('sidebar_collapsed', 'true') diff --git a/spec/features/merge_request/user_sees_closing_issues_message_spec.rb b/spec/features/merge_request/user_sees_closing_issues_message_spec.rb index 726f35557a7..d7c784b14c5 100644 --- a/spec/features/merge_request/user_sees_closing_issues_message_spec.rb +++ b/spec/features/merge_request/user_sees_closing_issues_message_spec.rb @@ -18,7 +18,7 @@ describe 'Merge request > User sees closing issues message', :js do let(:merge_request_title) { 'Merge Request Title' } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_merge_request_path(project, merge_request) wait_for_requests diff --git a/spec/features/merge_request/user_sees_deleted_target_branch_spec.rb b/spec/features/merge_request/user_sees_deleted_target_branch_spec.rb index 01115318370..46c21a2b155 100644 --- a/spec/features/merge_request/user_sees_deleted_target_branch_spec.rb +++ b/spec/features/merge_request/user_sees_deleted_target_branch_spec.rb @@ -6,7 +6,7 @@ describe 'Merge request > User sees deleted target branch', :js do let(:user) { project.creator } before do - project.add_master(user) + project.add_maintainer(user) DeleteBranchService.new(project, user).execute('feature') sign_in(user) visit project_merge_request_path(project, merge_request) diff --git a/spec/features/merge_request/user_sees_discussions_spec.rb b/spec/features/merge_request/user_sees_discussions_spec.rb index 10390bd5864..7b8c3bacfe2 100644 --- a/spec/features/merge_request/user_sees_discussions_spec.rb +++ b/spec/features/merge_request/user_sees_discussions_spec.rb @@ -6,7 +6,7 @@ describe 'Merge request > User sees discussions', :js do let(:merge_request) { create(:merge_request, source_project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/merge_request/user_sees_empty_state_spec.rb b/spec/features/merge_request/user_sees_empty_state_spec.rb index a939c7e9001..482f31b02d4 100644 --- a/spec/features/merge_request/user_sees_empty_state_spec.rb +++ b/spec/features/merge_request/user_sees_empty_state_spec.rb @@ -5,7 +5,7 @@ describe 'Merge request > User sees empty state' do let(:user) { project.creator } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb b/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb index 85df43df38e..f6b771facf8 100644 --- a/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb +++ b/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb @@ -6,7 +6,7 @@ describe 'Merge request > User sees merge button depending on unresolved discuss let!(:merge_request) { create(:merge_request_with_diff_notes, source_project: project, author: user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index 51a65407aec..b6b3844f2ae 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -10,8 +10,8 @@ describe 'Merge request > User sees merge widget', :js do let(:merge_request_in_only_mwps_project) { create(:merge_request, source_project: project_only_mwps) } before do - project.add_master(user) - project_only_mwps.add_master(user) + project.add_maintainer(user) + project_only_mwps.add_maintainer(user) sign_in(user) end @@ -275,7 +275,7 @@ describe 'Merge request > User sees merge widget', :js do let(:user2) { create(:user) } before do - project.add_master(user2) + project.add_maintainer(user2) sign_out(:user) sign_in(user2) merge_request.update(target_project: fork_project) diff --git a/spec/features/merge_request/user_sees_pipelines_spec.rb b/spec/features/merge_request/user_sees_pipelines_spec.rb index a42c016392b..45cccbee63e 100644 --- a/spec/features/merge_request/user_sees_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_pipelines_spec.rb @@ -7,7 +7,7 @@ describe 'Merge request > User sees pipelines', :js do let(:user) { project.creator } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end @@ -70,7 +70,7 @@ describe 'Merge request > User sees pipelines', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in user end diff --git a/spec/features/merge_request/user_sees_versions_spec.rb b/spec/features/merge_request/user_sees_versions_spec.rb index 11e0806ba62..f42b4dcbb47 100644 --- a/spec/features/merge_request/user_sees_versions_spec.rb +++ b/spec/features/merge_request/user_sees_versions_spec.rb @@ -10,7 +10,7 @@ describe 'Merge request > User sees versions', :js do let!(:params) { {} } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit diffs_project_merge_request_path(project, merge_request, params) end diff --git a/spec/features/merge_request/user_sees_wip_help_message_spec.rb b/spec/features/merge_request/user_sees_wip_help_message_spec.rb index bc25243244e..92cc73ddf1f 100644 --- a/spec/features/merge_request/user_sees_wip_help_message_spec.rb +++ b/spec/features/merge_request/user_sees_wip_help_message_spec.rb @@ -5,7 +5,7 @@ describe 'Merge request > User sees WIP help message' do let(:user) { project.creator } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb b/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb index ed6e29335d1..ae41cf90576 100644 --- a/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb +++ b/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb @@ -11,7 +11,7 @@ describe 'Merge request > User selects branches for new MR', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb b/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb index 2e95a628013..dd860382daa 100644 --- a/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb +++ b/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb @@ -6,7 +6,7 @@ describe 'Merge request > User toggles whitespace changes', :js do let(:user) { project.creator } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit diffs_project_merge_request_path(project, merge_request) end diff --git a/spec/features/merge_request/user_uses_slash_commands_spec.rb b/spec/features/merge_request/user_uses_slash_commands_spec.rb index 83ad4b45b5a..b81478a481f 100644 --- a/spec/features/merge_request/user_uses_slash_commands_spec.rb +++ b/spec/features/merge_request/user_uses_slash_commands_spec.rb @@ -21,7 +21,7 @@ describe 'Merge request > User uses quick actions', :js do let!(:milestone) { create(:milestone, project: project, title: 'ASAP') } before do - project.add_master(user) + project.add_maintainer(user) end describe 'time tracking' do @@ -147,7 +147,7 @@ describe 'Merge request > User uses quick actions', :js do let(:new_url_opts) { { merge_request: { source_branch: 'feature' } } } before do - another_project.add_master(user) + another_project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/merge_requests/user_mass_updates_spec.rb b/spec/features/merge_requests/user_mass_updates_spec.rb index 199ba7e87ad..bb327159cb0 100644 --- a/spec/features/merge_requests/user_mass_updates_spec.rb +++ b/spec/features/merge_requests/user_mass_updates_spec.rb @@ -6,7 +6,7 @@ describe 'Merge requests > User mass updates', :js do let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/merge_requests/user_squashes_merge_request_spec.rb b/spec/features/merge_requests/user_squashes_merge_request_spec.rb index da3d6772eeb..ec1153b7f7f 100644 --- a/spec/features/merge_requests/user_squashes_merge_request_spec.rb +++ b/spec/features/merge_requests/user_squashes_merge_request_spec.rb @@ -46,7 +46,7 @@ describe 'User squashes a merge request', :js do # Prevent source branch from being removed so we can use be_merged_to_root_ref # method to check if squash was performed or not allow_any_instance_of(MergeRequest).to receive(:force_remove_source_branch?).and_return(false) - project.add_master(user) + project.add_maintainer(user) sign_in user end diff --git a/spec/features/milestone_spec.rb b/spec/features/milestone_spec.rb index b12aba2c263..a0673b12738 100644 --- a/spec/features/milestone_spec.rb +++ b/spec/features/milestone_spec.rb @@ -7,7 +7,7 @@ describe 'Milestone' do before do create(:group_member, group: group, user: user) - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/profiles/user_visits_notifications_tab_spec.rb b/spec/features/profiles/user_visits_notifications_tab_spec.rb index 689196c2258..db797bb586f 100644 --- a/spec/features/profiles/user_visits_notifications_tab_spec.rb +++ b/spec/features/profiles/user_visits_notifications_tab_spec.rb @@ -5,7 +5,7 @@ describe 'User visits the notifications tab', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(profile_notifications_path) end diff --git a/spec/features/profiles/user_visits_profile_spec.rb b/spec/features/profiles/user_visits_profile_spec.rb index 713112477c8..2dc4547b2d8 100644 --- a/spec/features/profiles/user_visits_profile_spec.rb +++ b/spec/features/profiles/user_visits_profile_spec.rb @@ -29,7 +29,7 @@ describe 'User visits their profile' do let!(:project) do create(:project, :repository, namespace: group) do |project| create(:closed_issue_event, project: project) - project.add_master(user) + project.add_maintainer(user) end end diff --git a/spec/features/project_variables_spec.rb b/spec/features/project_variables_spec.rb index 0ba2224359a..a93df3696d2 100644 --- a/spec/features/project_variables_spec.rb +++ b/spec/features/project_variables_spec.rb @@ -8,7 +8,7 @@ describe 'Project variables', :js do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) project.variables << variable visit page_path diff --git a/spec/features/projects/actve_tabs_spec.rb b/spec/features/projects/actve_tabs_spec.rb index ce5606b63ae..7c6110c533b 100644 --- a/spec/features/projects/actve_tabs_spec.rb +++ b/spec/features/projects/actve_tabs_spec.rb @@ -5,7 +5,7 @@ describe 'Project active tab' do let(:project) { create(:project, :repository) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb b/spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb index 12e07647ecd..4d860893abe 100644 --- a/spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb +++ b/spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb @@ -6,7 +6,7 @@ describe 'User interacts with awards in an issue', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_issue_path(project, issue)) diff --git a/spec/features/projects/badges/list_spec.rb b/spec/features/projects/badges/list_spec.rb index da87039ad44..e30b908c60d 100644 --- a/spec/features/projects/badges/list_spec.rb +++ b/spec/features/projects/badges/list_spec.rb @@ -4,7 +4,7 @@ describe 'list of badges' do before do user = create(:user) project = create(:project, :repository) - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_settings_ci_cd_path(project) end diff --git a/spec/features/projects/blobs/blob_show_spec.rb b/spec/features/projects/blobs/blob_show_spec.rb index 7280d421cea..27589428896 100644 --- a/spec/features/projects/blobs/blob_show_spec.rb +++ b/spec/features/projects/blobs/blob_show_spec.rb @@ -144,7 +144,7 @@ describe 'File blob', :js do context 'Markdown file (stored in LFS)' do before do - project.add_master(project.creator) + project.add_maintainer(project.creator) Files::CreateService.new( project, @@ -237,7 +237,7 @@ describe 'File blob', :js do context 'PDF file' do before do - project.add_master(project.creator) + project.add_maintainer(project.creator) Files::CreateService.new( project, @@ -350,7 +350,7 @@ describe 'File blob', :js do context 'empty file' do before do - project.add_master(project.creator) + project.add_maintainer(project.creator) Files::CreateService.new( project, @@ -418,7 +418,7 @@ describe 'File blob', :js do context '.gitlab-ci.yml' do before do - project.add_master(project.creator) + project.add_maintainer(project.creator) Files::CreateService.new( project, @@ -446,7 +446,7 @@ describe 'File blob', :js do context '.gitlab/route-map.yml' do before do - project.add_master(project.creator) + project.add_maintainer(project.creator) Files::CreateService.new( project, @@ -494,7 +494,7 @@ describe 'File blob', :js do context '*.gemspec' do before do - project.add_master(project.creator) + project.add_maintainer(project.creator) Files::CreateService.new( project, diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 2657f5d999f..0e036b4ea68 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -134,11 +134,11 @@ describe 'Editing file blob', :js do end end - context 'as master' do + context 'as maintainer' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_edit_blob_path(project, tree_join(branch, file_path)) end diff --git a/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb b/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb index 0b7988f6335..8a0b92190dd 100644 --- a/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb +++ b/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb @@ -24,9 +24,9 @@ describe 'User creates blob in new project', :js do end end - describe 'as a master' do + describe 'as a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'creating a file' diff --git a/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb b/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb index 0be434a567b..0faf73db7da 100644 --- a/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb +++ b/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb @@ -6,7 +6,7 @@ describe 'New Branch Ref Dropdown', :js do let(:toggle) { find('.create-from .dropdown-menu-toggle') } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit new_project_branch_path(project) diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index b7ce1b9993a..97757e8da92 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -182,10 +182,10 @@ describe 'Branches' do end end - context 'logged in as master' do + context 'logged in as maintainer' do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) end describe 'Initial branches page' do diff --git a/spec/features/projects/clusters/applications_spec.rb b/spec/features/projects/clusters/applications_spec.rb index f57647a348f..a65ca662350 100644 --- a/spec/features/projects/clusters/applications_spec.rb +++ b/spec/features/projects/clusters/applications_spec.rb @@ -7,7 +7,7 @@ describe 'Clusters Applications', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index bd8cb9b4b94..31e3ebf675d 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -7,7 +7,7 @@ describe 'Gcp Cluster', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) gitlab_sign_in(user) allow(Projects::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 } end diff --git a/spec/features/projects/clusters/user_spec.rb b/spec/features/projects/clusters/user_spec.rb index a49dd72a91f..babf47cc341 100644 --- a/spec/features/projects/clusters/user_spec.rb +++ b/spec/features/projects/clusters/user_spec.rb @@ -7,7 +7,7 @@ describe 'User Cluster', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) gitlab_sign_in(user) allow(Projects::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 } end diff --git a/spec/features/projects/clusters_spec.rb b/spec/features/projects/clusters_spec.rb index a7274c99704..91eac9c8278 100644 --- a/spec/features/projects/clusters_spec.rb +++ b/spec/features/projects/clusters_spec.rb @@ -7,7 +7,7 @@ describe 'Clusters', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) gitlab_sign_in(user) end diff --git a/spec/features/projects/commit/builds_spec.rb b/spec/features/projects/commit/builds_spec.rb index da0552441fe..bd254caddfb 100644 --- a/spec/features/projects/commit/builds_spec.rb +++ b/spec/features/projects/commit/builds_spec.rb @@ -5,7 +5,7 @@ describe 'project commit pipelines', :js do before do user = create(:user) - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/commit/cherry_pick_spec.rb b/spec/features/projects/commit/cherry_pick_spec.rb index 1df45865d6f..bc3c00dafe2 100644 --- a/spec/features/projects/commit/cherry_pick_spec.rb +++ b/spec/features/projects/commit/cherry_pick_spec.rb @@ -9,7 +9,7 @@ describe 'Cherry-pick Commits' do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) visit project_commit_path(project, master_pickable_commit.id) end diff --git a/spec/features/projects/commit/comments/user_adds_comment_spec.rb b/spec/features/projects/commit/comments/user_adds_comment_spec.rb index 53866c32c69..6397df086a7 100644 --- a/spec/features/projects/commit/comments/user_adds_comment_spec.rb +++ b/spec/features/projects/commit/comments/user_adds_comment_spec.rb @@ -62,7 +62,7 @@ describe "User adds a comment on a commit", :js do click_diff_line(sample_commit.line_code) expect(page).to have_css(".js-temp-notes-holder form.new-note") - .and have_css(".js-close-discussion-note-form", text: "Discard draft") + .and have_css(".js-close-discussion-note-form", text: "Cancel") # The `Cancel` button closes the current form. The page should not have any open forms after that. find(".js-close-discussion-note-form").click diff --git a/spec/features/projects/commit/diff_notes_spec.rb b/spec/features/projects/commit/diff_notes_spec.rb index 6d66889761f..e2aefa35fad 100644 --- a/spec/features/projects/commit/diff_notes_spec.rb +++ b/spec/features/projects/commit/diff_notes_spec.rb @@ -7,7 +7,7 @@ describe 'Commit diff', :js do let(:project) { create(:project, :public, :repository) } before do - project.add_master(user) + project.add_maintainer(user) sign_in user end diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb index 35ed6620548..23d8d606790 100644 --- a/spec/features/projects/commits/user_browses_commits_spec.rb +++ b/spec/features/projects/commits/user_browses_commits_spec.rb @@ -7,7 +7,7 @@ describe 'User browses commits' do let(:project) { create(:project, :repository, namespace: user.namespace) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/compare_spec.rb b/spec/features/projects/compare_spec.rb index 7e863d9df32..69600884909 100644 --- a/spec/features/projects/compare_spec.rb +++ b/spec/features/projects/compare_spec.rb @@ -5,7 +5,7 @@ describe "Compare", :js do let(:project) { create(:project, :repository) } before do - project.add_master(user) + project.add_maintainer(user) sign_in user end diff --git a/spec/features/projects/deploy_keys_spec.rb b/spec/features/projects/deploy_keys_spec.rb index 1552a3512dd..e12532e97fa 100644 --- a/spec/features/projects/deploy_keys_spec.rb +++ b/spec/features/projects/deploy_keys_spec.rb @@ -5,7 +5,7 @@ describe 'Project deploy keys', :js do let(:project) { create(:project_empty_repo) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/diffs/diff_show_spec.rb b/spec/features/projects/diffs/diff_show_spec.rb index 237157cd89d..df05625d105 100644 --- a/spec/features/projects/diffs/diff_show_spec.rb +++ b/spec/features/projects/diffs/diff_show_spec.rb @@ -24,7 +24,7 @@ describe 'Diff file viewer', :js do context 'Ruby file (stored in LFS)' do before do - project.add_master(project.creator) + project.add_maintainer(project.creator) @commit_id = Files::CreateService.new( project, diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index 0c34309c1f4..4c5dda29fee 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -102,8 +102,8 @@ describe 'Environment' do context 'with terminal' do shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do - context 'for project master' do - let(:role) { :master } + context 'for project maintainer' do + let(:role) { :maintainer } it 'it shows the terminal button' do expect(page).to have_terminal_button @@ -166,7 +166,8 @@ describe 'Environment' do end it 'allows to stop environment' do - click_link('Stop') + click_button('Stop') + click_button('Stop environment') # confirm modal expect(page).to have_content('close_app') end @@ -174,7 +175,7 @@ describe 'Environment' do context 'when user has no ability to stop environment' do it 'does not allow to stop environment' do - expect(page).to have_no_link('Stop') + expect(page).not_to have_button('Stop') end end @@ -182,7 +183,7 @@ describe 'Environment' do let(:role) { :reporter } it 'does not show stop button' do - expect(page).not_to have_link('Stop') + expect(page).not_to have_button('Stop') end end end @@ -192,7 +193,7 @@ describe 'Environment' do let(:environment) { create(:environment, project: project, state: :stopped) } it 'does not show stop button' do - expect(page).not_to have_link('Stop') + expect(page).not_to have_button('Stop') end end end @@ -230,7 +231,7 @@ describe 'Environment' do it 'user visits environment page' do visit_environment(environment) - expect(page).to have_link('Stop') + expect(page).to have_button('Stop') end it 'user deletes the branch with running environment' do @@ -242,7 +243,7 @@ describe 'Environment' do visit_environment(environment) - expect(page).to have_no_link('Stop') + expect(page).not_to have_button('Stop') end ## diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 9900c13095e..f0890018286 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -10,6 +10,10 @@ describe 'Environments page', :js do sign_in(user) end + def stop_button_selector + %q{button[data-original-title="Stop environment"]} + end + describe 'page tabs' do it 'shows "Available" and "Stopped" tab with links' do visit_environments(project) @@ -120,7 +124,7 @@ describe 'Environments page', :js do end it 'does not show stip button when environment is not stoppable' do - expect(page).not_to have_selector('.stop-env-link') + expect(page).not_to have_selector(stop_button_selector) end end @@ -178,7 +182,7 @@ describe 'Environments page', :js do end it 'shows a stop button' do - expect(page).not_to have_selector('.stop-env-link') + expect(page).not_to have_selector(stop_button_selector) end it 'does not show external link button' do @@ -211,22 +215,22 @@ describe 'Environments page', :js do end it 'shows a stop button' do - expect(page).to have_selector('.stop-env-link') + expect(page).to have_selector(stop_button_selector) end context 'when user is a reporter' do let(:role) { :reporter } it 'does not show stop button' do - expect(page).not_to have_selector('.stop-env-link') + expect(page).not_to have_selector(stop_button_selector) end end end context 'when kubernetes terminal is available' do shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do - context 'for project master' do - let(:role) { :master } + context 'for project maintainer' do + let(:role) { :maintainer } it 'shows the terminal button' do expect(page).to have_terminal_button diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index b0eb7c5b42a..ab16fdee883 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -8,7 +8,7 @@ describe 'Edit Project Settings' do describe 'project features visibility selectors', :js do before do - project.add_master(member) + project.add_maintainer(member) sign_in(member) end @@ -165,7 +165,7 @@ describe 'Edit Project Settings' do describe 'repository visibility', :js do before do - project.add_master(member) + project.add_maintainer(member) sign_in(member) visit edit_project_path(project) end diff --git a/spec/features/projects/files/project_owner_creates_license_file_spec.rb b/spec/features/projects/files/project_owner_creates_license_file_spec.rb index b410199fd1f..ac6c8c337fa 100644 --- a/spec/features/projects/files/project_owner_creates_license_file_spec.rb +++ b/spec/features/projects/files/project_owner_creates_license_file_spec.rb @@ -2,16 +2,16 @@ require 'spec_helper' describe 'Projects > Files > Project owner creates a license file', :js do let(:project) { create(:project, :repository) } - let(:project_master) { project.owner } + let(:project_maintainer) { project.owner } before do - project.repository.delete_file(project_master, 'LICENSE', + project.repository.delete_file(project_maintainer, 'LICENSE', message: 'Remove LICENSE', branch_name: 'master') - sign_in(project_master) + sign_in(project_maintainer) visit project_path(project) end - it 'project master creates a license file manually from a template' do + it 'project maintainer creates a license file manually from a template' do visit project_tree_path(project, project.repository.root_ref) find('.add-to-tree').click click_link 'New file' @@ -35,7 +35,7 @@ describe 'Projects > Files > Project owner creates a license file', :js do expect(page).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}") end - it 'project master creates a license file from the "Add license" link' do + it 'project maintainer creates a license file from the "Add license" link' do click_link 'Add License' expect(page).to have_content('New file') diff --git a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb index 53d8ace7c94..801291c1f77 100644 --- a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb +++ b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb @@ -2,13 +2,13 @@ require 'spec_helper' describe 'Projects > Files > Project owner sees a link to create a license file in empty project', :js do let(:project) { create(:project_empty_repo) } - let(:project_master) { project.owner } + let(:project_maintainer) { project.owner } before do - sign_in(project_master) + sign_in(project_maintainer) end - it 'project master creates a license file from a template' do + it 'project maintainer creates a license file from a template' do visit project_path(project) click_on 'Add License' expect(page).to have_content('New file') diff --git a/spec/features/projects/files/template_selector_menu_spec.rb b/spec/features/projects/files/template_selector_menu_spec.rb index b7e1e172af9..6b313824acd 100644 --- a/spec/features/projects/files/template_selector_menu_spec.rb +++ b/spec/features/projects/files/template_selector_menu_spec.rb @@ -5,7 +5,7 @@ describe 'Template selector menu', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in user end diff --git a/spec/features/projects/files/user_creates_files_spec.rb b/spec/features/projects/files/user_creates_files_spec.rb index 208cc8d81f7..d4dda43c823 100644 --- a/spec/features/projects/files/user_creates_files_spec.rb +++ b/spec/features/projects/files/user_creates_files_spec.rb @@ -12,7 +12,7 @@ describe 'Projects > Files > User creates files' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/files/user_deletes_files_spec.rb b/spec/features/projects/files/user_deletes_files_spec.rb index 36d3e001a64..0e9f83a16ce 100644 --- a/spec/features/projects/files/user_deletes_files_spec.rb +++ b/spec/features/projects/files/user_deletes_files_spec.rb @@ -17,7 +17,7 @@ describe 'Projects > Files > User deletes files' do context 'when an user has write access' do before do - project.add_master(user) + project.add_maintainer(user) visit(project_tree_path_root_ref) end diff --git a/spec/features/projects/files/user_edits_files_spec.rb b/spec/features/projects/files/user_edits_files_spec.rb index dc6e4fd27cb..ccc1bc1bc10 100644 --- a/spec/features/projects/files/user_edits_files_spec.rb +++ b/spec/features/projects/files/user_edits_files_spec.rb @@ -31,7 +31,7 @@ describe 'Projects > Files > User edits files' do context 'when an user has write access' do before do - project.add_master(user) + project.add_maintainer(user) visit(project_tree_path_root_ref) end diff --git a/spec/features/projects/files/user_find_file_spec.rb b/spec/features/projects/files/user_find_file_spec.rb index df405e70dd4..e2d881b34d2 100644 --- a/spec/features/projects/files/user_find_file_spec.rb +++ b/spec/features/projects/files/user_find_file_spec.rb @@ -6,7 +6,7 @@ describe 'User find project file' do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) visit project_tree_path(project, project.repository.root_ref) end diff --git a/spec/features/projects/files/user_reads_pipeline_status_spec.rb b/spec/features/projects/files/user_reads_pipeline_status_spec.rb index 2d0b447913e..ff0aa933a3e 100644 --- a/spec/features/projects/files/user_reads_pipeline_status_spec.rb +++ b/spec/features/projects/files/user_reads_pipeline_status_spec.rb @@ -7,7 +7,7 @@ describe 'user reads pipeline status', :js do let(:x110_pipeline) { create_pipeline('x1.1.0', 'failed') } before do - project.add_master(user) + project.add_maintainer(user) project.repository.add_tag(user, 'x1.1.0', 'v1.1.0') v110_pipeline diff --git a/spec/features/projects/files/user_replaces_files_spec.rb b/spec/features/projects/files/user_replaces_files_spec.rb index 9ac3417b671..3a81e77c4ba 100644 --- a/spec/features/projects/files/user_replaces_files_spec.rb +++ b/spec/features/projects/files/user_replaces_files_spec.rb @@ -19,7 +19,7 @@ describe 'Projects > Files > User replaces files' do context 'when an user has write access' do before do - project.add_master(user) + project.add_maintainer(user) visit(project_tree_path_root_ref) end diff --git a/spec/features/projects/files/user_uploads_files_spec.rb b/spec/features/projects/files/user_uploads_files_spec.rb index 8b212faa29d..af3fc528a20 100644 --- a/spec/features/projects/files/user_uploads_files_spec.rb +++ b/spec/features/projects/files/user_uploads_files_spec.rb @@ -14,7 +14,7 @@ describe 'Projects > Files > User uploads files' do let(:project2_tree_path_root_ref) { project_tree_path(project2, project2.repository.root_ref) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/fork_spec.rb b/spec/features/projects/fork_spec.rb index 1743b1e083f..cd5fef8238e 100644 --- a/spec/features/projects/fork_spec.rb +++ b/spec/features/projects/fork_spec.rb @@ -129,11 +129,11 @@ describe 'Project fork' do end end - context 'master in group' do + context 'maintainer in group' do let(:group) { create(:group) } before do - group.add_master(user) + group.add_maintainer(user) end it 'allows user to fork project to group or to user namespace' do diff --git a/spec/features/projects/graph_spec.rb b/spec/features/projects/graph_spec.rb index 335174b7729..9665f1755d6 100644 --- a/spec/features/projects/graph_spec.rb +++ b/spec/features/projects/graph_spec.rb @@ -6,7 +6,7 @@ describe 'Project Graph', :js do let(:branch_name) { 'master' } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/hook_logs/user_reads_log_spec.rb b/spec/features/projects/hook_logs/user_reads_log_spec.rb index c3bc35565f6..086cd4b9f03 100644 --- a/spec/features/projects/hook_logs/user_reads_log_spec.rb +++ b/spec/features/projects/hook_logs/user_reads_log_spec.rb @@ -6,7 +6,7 @@ describe 'Hook logs' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/issuable_templates_spec.rb b/spec/features/projects/issuable_templates_spec.rb index 9cd4af2de80..a57edc394f9 100644 --- a/spec/features/projects/issuable_templates_spec.rb +++ b/spec/features/projects/issuable_templates_spec.rb @@ -8,7 +8,7 @@ describe 'issuable templates', :js do let(:issue_form_location) { '#content-body .issuable-details .detail-page-description' } before do - project.add_master(user) + project.add_maintainer(user) sign_in user end diff --git a/spec/features/projects/jobs/user_browses_job_spec.rb b/spec/features/projects/jobs/user_browses_job_spec.rb index ce0b38b7239..50e957bf12b 100644 --- a/spec/features/projects/jobs/user_browses_job_spec.rb +++ b/spec/features/projects/jobs/user_browses_job_spec.rb @@ -8,7 +8,7 @@ describe 'User browses a job', :js do let!(:build) { create(:ci_build, :success, :trace_artifact, :coverage, pipeline: pipeline) } before do - project.add_master(user) + project.add_maintainer(user) project.enable_ci sign_in(user) diff --git a/spec/features/projects/jobs/user_browses_jobs_spec.rb b/spec/features/projects/jobs/user_browses_jobs_spec.rb index 786ec327b92..08786fe1630 100644 --- a/spec/features/projects/jobs/user_browses_jobs_spec.rb +++ b/spec/features/projects/jobs/user_browses_jobs_spec.rb @@ -7,7 +7,7 @@ describe 'User browses jobs' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) project.enable_ci project.update_attribute(:build_coverage_regex, /Coverage (\d+)%/) diff --git a/spec/features/projects/labels/user_creates_labels_spec.rb b/spec/features/projects/labels/user_creates_labels_spec.rb index 9fd7f3ee775..c71b04fea09 100644 --- a/spec/features/projects/labels/user_creates_labels_spec.rb +++ b/spec/features/projects/labels/user_creates_labels_spec.rb @@ -18,7 +18,7 @@ describe "User creates labels" do context "in project" do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(new_project_label_path(project)) @@ -69,7 +69,7 @@ describe "User creates labels" do before do create(:label, project: project, title: "bug") # Create label for `project` (not `another_project`) project. - another_project.add_master(user) + another_project.add_maintainer(user) sign_in(user) visit(new_project_label_path(another_project)) diff --git a/spec/features/projects/labels/user_edits_labels_spec.rb b/spec/features/projects/labels/user_edits_labels_spec.rb index d1041ff5c1e..0708bbd40ce 100644 --- a/spec/features/projects/labels/user_edits_labels_spec.rb +++ b/spec/features/projects/labels/user_edits_labels_spec.rb @@ -6,7 +6,7 @@ describe "User edits labels" do set(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(edit_project_label_path(project, label)) diff --git a/spec/features/projects/labels/user_removes_labels_spec.rb b/spec/features/projects/labels/user_removes_labels_spec.rb index efa74015c6e..b0ce03a1c31 100644 --- a/spec/features/projects/labels/user_removes_labels_spec.rb +++ b/spec/features/projects/labels/user_removes_labels_spec.rb @@ -5,7 +5,7 @@ describe "User removes labels" do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/members/anonymous_user_sees_members_spec.rb b/spec/features/projects/members/anonymous_user_sees_members_spec.rb index 19e52294a38..b3ed725f602 100644 --- a/spec/features/projects/members/anonymous_user_sees_members_spec.rb +++ b/spec/features/projects/members/anonymous_user_sees_members_spec.rb @@ -6,7 +6,7 @@ describe 'Projects > Members > Anonymous user sees members' do let(:project) { create(:project, :public) } before do - project.add_master(user) + project.add_maintainer(user) create(:project_group_link, project: project, group: group) end diff --git a/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb b/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb index 7bc53345ddf..bb475ea95e5 100644 --- a/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb +++ b/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb @@ -12,8 +12,8 @@ describe 'Projects > Members > Group member cannot request access to his group p expect(page).not_to have_content 'Request Access' end - it 'master does not see the request access button' do - group.add_master(user) + it 'maintainer does not see the request access button' do + group.add_maintainer(user) login_and_visit_project_page(user) expect(page).not_to have_content 'Request Access' diff --git a/spec/features/projects/members/groups_with_access_list_spec.rb b/spec/features/projects/members/groups_with_access_list_spec.rb index b65c46b345f..c0b5d943e96 100644 --- a/spec/features/projects/members/groups_with_access_list_spec.rb +++ b/spec/features/projects/members/groups_with_access_list_spec.rb @@ -6,7 +6,7 @@ describe 'Projects > Members > Groups with access list', :js do let(:project) { create(:project, :public) } before do - project.add_master(user) + project.add_maintainer(user) @group_link = create(:project_group_link, project: project, group: group) sign_in(user) diff --git a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb index 90f09bf6264..26de6fb33fd 100644 --- a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb +++ b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb @@ -1,16 +1,16 @@ require 'spec_helper' -describe 'Projects > Members > Master adds member with expiration date', :js do +describe 'Projects > Members > Maintainer adds member with expiration date', :js do include Select2Helper include ActiveSupport::Testing::TimeHelpers - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:project) { create(:project) } let!(:new_member) { create(:user) } before do - project.add_master(master) - sign_in(master) + project.add_maintainer(maintainer) + sign_in(maintainer) end it 'expiration date is displayed in the members list' do diff --git a/spec/features/projects/members/master_manages_access_requests_spec.rb b/spec/features/projects/members/master_manages_access_requests_spec.rb index 112b06c047d..adc8202cde7 100644 --- a/spec/features/projects/members/master_manages_access_requests_spec.rb +++ b/spec/features/projects/members/master_manages_access_requests_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe 'Projects > Members > Master manages access requests' do - it_behaves_like 'Master manages access requests' do +describe 'Projects > Members > Maintainer manages access requests' do + it_behaves_like 'Maintainer manages access requests' do let(:entity) { create(:project, :public, :access_requestable) } let(:members_page_path) { project_project_members_path(entity) } end diff --git a/spec/features/projects/members/share_with_group_spec.rb b/spec/features/projects/members/share_with_group_spec.rb index b126f0c6cb1..c6d85e5d22f 100644 --- a/spec/features/projects/members/share_with_group_spec.rb +++ b/spec/features/projects/members/share_with_group_spec.rb @@ -4,7 +4,7 @@ describe 'Project > Members > Share with Group', :js do include Select2Helper include ActionView::Helpers::DateHelper - let(:master) { create(:user) } + let(:maintainer) { create(:user) } describe 'Share with group lock' do shared_examples 'the project can be shared with groups' do @@ -27,8 +27,8 @@ describe 'Project > Members > Share with Group', :js do let(:project) { create(:project, namespace: create(:group)) } before do - project.add_master(master) - sign_in(master) + project.add_maintainer(maintainer) + sign_in(maintainer) end context 'when the group has "Share with group lock" disabled' do @@ -65,8 +65,8 @@ describe 'Project > Members > Share with Group', :js do let(:project) { create(:project, namespace: subgroup) } before do - project.add_master(master) - sign_in(master) + project.add_maintainer(maintainer) + sign_in(maintainer) end context 'when the root_group has "Share with group lock" disabled' do @@ -112,8 +112,8 @@ describe 'Project > Members > Share with Group', :js do end before do - project.add_master(master) - sign_in(master) + project.add_maintainer(maintainer) + sign_in(maintainer) visit project_settings_members_path(project) @@ -142,11 +142,11 @@ describe 'Project > Members > Share with Group', :js do let(:project) { create(:project) } before do - project.add_master(master) - sign_in(master) + project.add_maintainer(maintainer) + sign_in(maintainer) - create(:group).add_owner(master) - create(:group).add_owner(master) + create(:group).add_owner(maintainer) + create(:group).add_owner(maintainer) visit project_settings_members_path(project) @@ -174,10 +174,10 @@ describe 'Project > Members > Share with Group', :js do let!(:project) { create(:project, namespace: nested_group) } before do - project.add_master(master) - sign_in(master) - group.add_master(master) - group_to_share_with.add_master(master) + project.add_maintainer(maintainer) + sign_in(maintainer) + group.add_maintainer(maintainer) + group_to_share_with.add_maintainer(maintainer) end it 'the groups dropdown does not show ancestors', :nested_groups do diff --git a/spec/features/projects/members/sorting_spec.rb b/spec/features/projects/members/sorting_spec.rb index 1e1071348c3..220775b514d 100644 --- a/spec/features/projects/members/sorting_spec.rb +++ b/spec/features/projects/members/sorting_spec.rb @@ -1,20 +1,20 @@ require 'spec_helper' describe 'Projects > Members > Sorting' do - let(:master) { create(:user, name: 'John Doe') } + let(:maintainer) { create(:user, name: 'John Doe') } let(:developer) { create(:user, name: 'Mary Jane', last_sign_in_at: 5.days.ago) } - let(:project) { create(:project, namespace: master.namespace, creator: master) } + let(:project) { create(:project, namespace: maintainer.namespace, creator: maintainer) } before do create(:project_member, :developer, user: developer, project: project, created_at: 3.days.ago) - sign_in(master) + sign_in(maintainer) end it 'sorts alphabetically by default' do visit_members_list(sort: nil) - expect(first_member).to include(master.name) + expect(first_member).to include(maintainer.name) expect(second_member).to include(developer.name) expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Name, ascending') end @@ -23,14 +23,14 @@ describe 'Projects > Members > Sorting' do visit_members_list(sort: :access_level_asc) expect(first_member).to include(developer.name) - expect(second_member).to include(master.name) + expect(second_member).to include(maintainer.name) expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Access level, ascending') end it 'sorts by access level descending' do visit_members_list(sort: :access_level_desc) - expect(first_member).to include(master.name) + expect(first_member).to include(maintainer.name) expect(second_member).to include(developer.name) expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Access level, descending') end @@ -38,7 +38,7 @@ describe 'Projects > Members > Sorting' do it 'sorts by last joined' do visit_members_list(sort: :last_joined) - expect(first_member).to include(master.name) + expect(first_member).to include(maintainer.name) expect(second_member).to include(developer.name) expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Last joined') end @@ -47,14 +47,14 @@ describe 'Projects > Members > Sorting' do visit_members_list(sort: :oldest_joined) expect(first_member).to include(developer.name) - expect(second_member).to include(master.name) + expect(second_member).to include(maintainer.name) expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Oldest joined') end it 'sorts by name ascending' do visit_members_list(sort: :name_asc) - expect(first_member).to include(master.name) + expect(first_member).to include(maintainer.name) expect(second_member).to include(developer.name) expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Name, ascending') end @@ -63,14 +63,14 @@ describe 'Projects > Members > Sorting' do visit_members_list(sort: :name_desc) expect(first_member).to include(developer.name) - expect(second_member).to include(master.name) + expect(second_member).to include(maintainer.name) expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Name, descending') end it 'sorts by recent sign in', :clean_gitlab_redis_shared_state do visit_members_list(sort: :recent_sign_in) - expect(first_member).to include(master.name) + expect(first_member).to include(maintainer.name) expect(second_member).to include(developer.name) expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Recent sign in') end @@ -79,7 +79,7 @@ describe 'Projects > Members > Sorting' do visit_members_list(sort: :oldest_sign_in) expect(first_member).to include(developer.name) - expect(second_member).to include(master.name) + expect(second_member).to include(maintainer.name) expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Oldest sign in') end diff --git a/spec/features/projects/members/user_requests_access_spec.rb b/spec/features/projects/members/user_requests_access_spec.rb index 5599cc9bf1b..50ba67f0ffc 100644 --- a/spec/features/projects/members/user_requests_access_spec.rb +++ b/spec/features/projects/members/user_requests_access_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'Projects > Members > User requests access', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, :access_requestable, :repository) } - let(:master) { project.owner } + let(:maintainer) { project.owner } before do sign_in(user) @@ -20,7 +20,7 @@ describe 'Projects > Members > User requests access', :js do it 'user can request access to a project' do perform_enqueued_jobs { click_link 'Request Access' } - expect(ActionMailer::Base.deliveries.last.to).to eq [master.notification_email] + expect(ActionMailer::Base.deliveries.last.to).to eq [maintainer.notification_email] expect(ActionMailer::Base.deliveries.last.subject).to eq "Request to join the #{project.full_name} project" expect(project.requesters.exists?(user_id: user)).to be_truthy diff --git a/spec/features/projects/merge_requests/user_closes_merge_request_spec.rb b/spec/features/projects/merge_requests/user_closes_merge_request_spec.rb index b257f447439..2d12d690151 100644 --- a/spec/features/projects/merge_requests/user_closes_merge_request_spec.rb +++ b/spec/features/projects/merge_requests/user_closes_merge_request_spec.rb @@ -6,7 +6,7 @@ describe 'User closes a merge requests', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(merge_request_path(merge_request)) diff --git a/spec/features/projects/merge_requests/user_comments_on_commit_spec.rb b/spec/features/projects/merge_requests/user_comments_on_commit_spec.rb index 0a952cfc2a9..8ea358bcc70 100644 --- a/spec/features/projects/merge_requests/user_comments_on_commit_spec.rb +++ b/spec/features/projects/merge_requests/user_comments_on_commit_spec.rb @@ -9,7 +9,7 @@ describe 'User comments on a commit', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_commit_path(project, sample_commit.id)) diff --git a/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb index 1828b60fec7..441b080bee5 100644 --- a/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb +++ b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb @@ -11,7 +11,7 @@ describe 'User comments on a diff', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(diffs_project_merge_request_path(project, merge_request)) @@ -31,7 +31,7 @@ describe 'User comments on a diff', :js do page.within('.files > div:nth-child(3)') do expect(page).to have_content('Line is wrong') - find('.js-toggle-diff-comments').click + find('.js-btn-vue-toggle-comments').click expect(page).not_to have_content('Line is wrong') end @@ -64,7 +64,7 @@ describe 'User comments on a diff', :js do # Hide the comment. page.within('.files > div:nth-child(3)') do - find('.js-toggle-diff-comments').click + find('.js-btn-vue-toggle-comments').click expect(page).not_to have_content('Line is wrong') end @@ -77,7 +77,7 @@ describe 'User comments on a diff', :js do # Show the comment. page.within('.files > div:nth-child(3)') do - find('.js-toggle-diff-comments').click + find('.js-btn-vue-toggle-comments').click end # Now both the comments should be shown. diff --git a/spec/features/projects/merge_requests/user_comments_on_merge_request_spec.rb b/spec/features/projects/merge_requests/user_comments_on_merge_request_spec.rb index f90aaba3caf..69bdab85d81 100644 --- a/spec/features/projects/merge_requests/user_comments_on_merge_request_spec.rb +++ b/spec/features/projects/merge_requests/user_comments_on_merge_request_spec.rb @@ -8,7 +8,7 @@ describe 'User comments on a merge request', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(merge_request_path(merge_request)) diff --git a/spec/features/projects/merge_requests/user_creates_merge_request_spec.rb b/spec/features/projects/merge_requests/user_creates_merge_request_spec.rb index 1f21ef7b382..38b4e4a6d1b 100644 --- a/spec/features/projects/merge_requests/user_creates_merge_request_spec.rb +++ b/spec/features/projects/merge_requests/user_creates_merge_request_spec.rb @@ -8,7 +8,7 @@ describe "User creates a merge request", :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb b/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb index 3d19a2923b9..7de0f9daac6 100644 --- a/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb +++ b/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb @@ -8,7 +8,7 @@ describe 'User edits a merge request', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(edit_project_merge_request_path(project, merge_request)) diff --git a/spec/features/projects/merge_requests/user_manages_subscription_spec.rb b/spec/features/projects/merge_requests/user_manages_subscription_spec.rb index f55eb5c6664..68a835e7f77 100644 --- a/spec/features/projects/merge_requests/user_manages_subscription_spec.rb +++ b/spec/features/projects/merge_requests/user_manages_subscription_spec.rb @@ -6,7 +6,7 @@ describe 'User manages subscription', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(merge_request_path(merge_request)) diff --git a/spec/features/projects/merge_requests/user_reopens_merge_request_spec.rb b/spec/features/projects/merge_requests/user_reopens_merge_request_spec.rb index ba3c9789da1..745b4537e72 100644 --- a/spec/features/projects/merge_requests/user_reopens_merge_request_spec.rb +++ b/spec/features/projects/merge_requests/user_reopens_merge_request_spec.rb @@ -6,7 +6,7 @@ describe 'User reopens a merge requests', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(merge_request_path(merge_request)) diff --git a/spec/features/projects/merge_requests/user_sorts_merge_requests_spec.rb b/spec/features/projects/merge_requests/user_sorts_merge_requests_spec.rb index 305658f1b5d..e401933aed2 100644 --- a/spec/features/projects/merge_requests/user_sorts_merge_requests_spec.rb +++ b/spec/features/projects/merge_requests/user_sorts_merge_requests_spec.rb @@ -9,7 +9,7 @@ describe 'User sorts merge requests' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_merge_requests_path(project)) diff --git a/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb b/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb index 3aac93eaf7c..6ac495aa03d 100644 --- a/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb +++ b/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb @@ -31,7 +31,7 @@ describe 'User views an open merge request' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(edit_project_merge_request_path(project, merge_request)) diff --git a/spec/features/projects/milestones/user_interacts_with_labels_spec.rb b/spec/features/projects/milestones/user_interacts_with_labels_spec.rb index f6a82f80d65..a6d58be7b13 100644 --- a/spec/features/projects/milestones/user_interacts_with_labels_spec.rb +++ b/spec/features/projects/milestones/user_interacts_with_labels_spec.rb @@ -11,7 +11,7 @@ describe 'User interacts with labels' do let(:label_enhancement) { create(:label, project: project, title: 'enhancement') } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) issue1.labels << [label_bug, label_feature] diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index f23ec11a458..df8528e79dd 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -94,7 +94,7 @@ describe 'New project' do let(:subgroup) { create(:group, parent: group) } before do - group.add_master(user) + group.add_maintainer(user) visit new_project_path(namespace_id: subgroup.id) end diff --git a/spec/features/projects/pages_spec.rb b/spec/features/projects/pages_spec.rb index 6bf65e16291..831f22a0e69 100644 --- a/spec/features/projects/pages_spec.rb +++ b/spec/features/projects/pages_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'Pages' do let(:project) { create(:project) } let(:user) { create(:user) } - let(:role) { :master } + let(:role) { :maintainer } before do allow(Gitlab.config.pages).to receive(:enabled).and_return(true) diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb index 220b3529c59..ee6b67b2188 100644 --- a/spec/features/projects/pipeline_schedules_spec.rb +++ b/spec/features/projects/pipeline_schedules_spec.rb @@ -9,9 +9,9 @@ describe 'Pipeline Schedules', :js do let(:scope) { nil } let!(:user) { create(:user) } - context 'logged in as master' do + context 'logged in as maintainer' do before do - project.add_master(user) + project.add_maintainer(user) gitlab_sign_in(user) end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 7d47e342e92..4a83bcc3efb 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -595,7 +595,7 @@ describe 'Pipelines', :js do before do create(:ci_empty_pipeline, status: 'success', project: project, sha: project.commit.id, ref: 'master') - project.add_master(user) + project.add_maintainer(user) visit project_pipelines_path(project) end diff --git a/spec/features/projects/remote_mirror_spec.rb b/spec/features/projects/remote_mirror_spec.rb index 97db4a2b8f2..5259a8942dc 100644 --- a/spec/features/projects/remote_mirror_spec.rb +++ b/spec/features/projects/remote_mirror_spec.rb @@ -7,7 +7,7 @@ describe 'Project remote mirror', :feature do describe 'On a project', :js do before do - project.add_master(user) + project.add_maintainer(user) sign_in user end diff --git a/spec/features/projects/services/user_activates_asana_spec.rb b/spec/features/projects/services/user_activates_asana_spec.rb index db836d2985c..c44e07dd3b4 100644 --- a/spec/features/projects/services/user_activates_asana_spec.rb +++ b/spec/features/projects/services/user_activates_asana_spec.rb @@ -5,7 +5,7 @@ describe 'User activates Asana' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_assembla_spec.rb b/spec/features/projects/services/user_activates_assembla_spec.rb index f099b332785..9c3884a7c74 100644 --- a/spec/features/projects/services/user_activates_assembla_spec.rb +++ b/spec/features/projects/services/user_activates_assembla_spec.rb @@ -5,7 +5,7 @@ describe 'User activates Assembla' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb b/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb index a00c2e0ad99..19573565265 100644 --- a/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb +++ b/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb @@ -5,7 +5,7 @@ describe 'User activates Atlassian Bamboo CI' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_emails_on_push_spec.rb b/spec/features/projects/services/user_activates_emails_on_push_spec.rb index 3769875b29c..cc55f7b2060 100644 --- a/spec/features/projects/services/user_activates_emails_on_push_spec.rb +++ b/spec/features/projects/services/user_activates_emails_on_push_spec.rb @@ -5,7 +5,7 @@ describe 'User activates Emails on push' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_flowdock_spec.rb b/spec/features/projects/services/user_activates_flowdock_spec.rb index 5298d8acaf5..f981b7e9da9 100644 --- a/spec/features/projects/services/user_activates_flowdock_spec.rb +++ b/spec/features/projects/services/user_activates_flowdock_spec.rb @@ -5,7 +5,7 @@ describe 'User activates Flowdock' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_hipchat_spec.rb b/spec/features/projects/services/user_activates_hipchat_spec.rb index a9bf16642c7..2f5313c91f9 100644 --- a/spec/features/projects/services/user_activates_hipchat_spec.rb +++ b/spec/features/projects/services/user_activates_hipchat_spec.rb @@ -5,7 +5,7 @@ describe 'User activates HipChat' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_irker_spec.rb b/spec/features/projects/services/user_activates_irker_spec.rb index 435663c818f..4c8e321b411 100644 --- a/spec/features/projects/services/user_activates_irker_spec.rb +++ b/spec/features/projects/services/user_activates_irker_spec.rb @@ -5,7 +5,7 @@ describe 'User activates Irker (IRC gateway)' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_issue_tracker_spec.rb b/spec/features/projects/services/user_activates_issue_tracker_spec.rb index e9502178bd7..7cd5b12802b 100644 --- a/spec/features/projects/services/user_activates_issue_tracker_spec.rb +++ b/spec/features/projects/services/user_activates_issue_tracker_spec.rb @@ -15,7 +15,7 @@ describe 'User activates issue tracker', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_settings_integrations_path(project) diff --git a/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb b/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb index 1048803fde8..28d83a8b961 100644 --- a/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb +++ b/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb @@ -5,7 +5,7 @@ describe 'User activates JetBrains TeamCity CI' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_jira_spec.rb b/spec/features/projects/services/user_activates_jira_spec.rb index 429128ec096..08e1855d034 100644 --- a/spec/features/projects/services/user_activates_jira_spec.rb +++ b/spec/features/projects/services/user_activates_jira_spec.rb @@ -17,7 +17,7 @@ describe 'User activates Jira', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_settings_integrations_path(project) diff --git a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb index d4a6417290d..25b74cc481d 100644 --- a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb +++ b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb @@ -8,7 +8,7 @@ describe 'Setup Mattermost slash commands', :js do before do stub_mattermost_setting(enabled: mattermost_enabled) - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit edit_project_service_path(project, service) end diff --git a/spec/features/projects/services/user_activates_packagist_spec.rb b/spec/features/projects/services/user_activates_packagist_spec.rb index b0cc818f093..756e9b33c07 100644 --- a/spec/features/projects/services/user_activates_packagist_spec.rb +++ b/spec/features/projects/services/user_activates_packagist_spec.rb @@ -5,7 +5,7 @@ describe 'User activates Packagist' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_pivotaltracker_spec.rb b/spec/features/projects/services/user_activates_pivotaltracker_spec.rb index d5d109ba48b..1d6b19e0b0c 100644 --- a/spec/features/projects/services/user_activates_pivotaltracker_spec.rb +++ b/spec/features/projects/services/user_activates_pivotaltracker_spec.rb @@ -5,7 +5,7 @@ describe 'User activates PivotalTracker' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_prometheus_spec.rb b/spec/features/projects/services/user_activates_prometheus_spec.rb index 33f884eb148..61361c8a2e3 100644 --- a/spec/features/projects/services/user_activates_prometheus_spec.rb +++ b/spec/features/projects/services/user_activates_prometheus_spec.rb @@ -5,7 +5,7 @@ describe 'User activates Prometheus' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_pushover_spec.rb b/spec/features/projects/services/user_activates_pushover_spec.rb index 9b7e8d62792..24612ee1457 100644 --- a/spec/features/projects/services/user_activates_pushover_spec.rb +++ b/spec/features/projects/services/user_activates_pushover_spec.rb @@ -5,7 +5,7 @@ describe 'User activates Pushover' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/services/user_activates_slack_notifications_spec.rb b/spec/features/projects/services/user_activates_slack_notifications_spec.rb index 727b1fe2d11..24b5d5259db 100644 --- a/spec/features/projects/services/user_activates_slack_notifications_spec.rb +++ b/spec/features/projects/services/user_activates_slack_notifications_spec.rb @@ -6,7 +6,7 @@ describe 'User activates Slack notifications' do let(:project) { create(:project, slack_service: service) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/services/user_activates_slack_slash_command_spec.rb b/spec/features/projects/services/user_activates_slack_slash_command_spec.rb index f540b76c784..08cfddf7993 100644 --- a/spec/features/projects/services/user_activates_slack_slash_command_spec.rb +++ b/spec/features/projects/services/user_activates_slack_slash_command_spec.rb @@ -6,7 +6,7 @@ describe 'Slack slash commands' do let(:service) { project.create_slack_slash_commands_service } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit edit_project_service_path(project, service) end diff --git a/spec/features/projects/services/user_views_services_spec.rb b/spec/features/projects/services/user_views_services_spec.rb index 5c5e8b66642..e9c8cf0fe34 100644 --- a/spec/features/projects/services/user_views_services_spec.rb +++ b/spec/features/projects/services/user_views_services_spec.rb @@ -5,7 +5,7 @@ describe 'User views services' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_settings_integrations_path(project)) diff --git a/spec/features/projects/settings/forked_project_settings_spec.rb b/spec/features/projects/settings/forked_project_settings_spec.rb index a4d1b78b83b..df33d215602 100644 --- a/spec/features/projects/settings/forked_project_settings_spec.rb +++ b/spec/features/projects/settings/forked_project_settings_spec.rb @@ -7,8 +7,8 @@ describe 'Projects > Settings > For a forked project', :js do let(:forked_project) { fork_project(original_project, user) } before do - original_project.add_master(user) - forked_project.add_master(user) + original_project.add_maintainer(user) + forked_project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/settings/integration_settings_spec.rb b/spec/features/projects/settings/integration_settings_spec.rb index 5178d63050e..8745ff72df0 100644 --- a/spec/features/projects/settings/integration_settings_spec.rb +++ b/spec/features/projects/settings/integration_settings_spec.rb @@ -21,8 +21,8 @@ describe 'Projects > Settings > Integration settings' do end end - context 'for master' do - let(:role) { :master } + context 'for maintainer' do + let(:role) { :maintainer } context 'Webhooks' do let(:hook) { create(:project_hook, :all_events_enabled, enable_ssl_verification: true, project: project) } diff --git a/spec/features/projects/settings/lfs_settings_spec.rb b/spec/features/projects/settings/lfs_settings_spec.rb index 342be1d2a9d..befb306b48d 100644 --- a/spec/features/projects/settings/lfs_settings_spec.rb +++ b/spec/features/projects/settings/lfs_settings_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe 'Projects > Settings > LFS settings' do let(:project) { create(:project) } let(:user) { create(:user) } - let(:role) { :master } + let(:role) { :maintainer } context 'LFS enabled setting' do before do @@ -13,8 +13,8 @@ describe 'Projects > Settings > LFS settings' do project.add_role(user, role) end - context 'for master' do - let(:role) { :master } + context 'for maintainer' do + let(:role) { :maintainer } it 'displays the correct elements', :js do visit edit_project_path(project) diff --git a/spec/features/projects/settings/pipelines_settings_spec.rb b/spec/features/projects/settings/pipelines_settings_spec.rb index cfdae246c09..742ecf82c38 100644 --- a/spec/features/projects/settings/pipelines_settings_spec.rb +++ b/spec/features/projects/settings/pipelines_settings_spec.rb @@ -21,8 +21,8 @@ describe "Projects > Settings > Pipelines settings" do end end - context 'for master' do - let(:role) { :master } + context 'for maintainer' do + let(:role) { :maintainer } it 'be allowed to change' do visit project_settings_ci_cd_path(project) diff --git a/spec/features/projects/settings/project_badges_spec.rb b/spec/features/projects/settings/project_badges_spec.rb index e53da997c1d..2ec94274f80 100644 --- a/spec/features/projects/settings/project_badges_spec.rb +++ b/spec/features/projects/settings/project_badges_spec.rb @@ -12,7 +12,7 @@ describe 'Project Badges' do let!(:group_badge) { create(:group_badge, group: group) } before do - group.add_master(user) + group.add_maintainer(user) sign_in(user) visit(project_settings_badges_path(project)) diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index f085e1aa50a..a0f5b234ebc 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -20,8 +20,8 @@ describe 'Projects > Settings > Repository settings' do end end - context 'for master' do - let(:role) { :master } + context 'for maintainer' do + let(:role) { :maintainer } context 'Deploy Keys', :js do let(:private_deploy_key) { create(:deploy_key, title: 'private_deploy_key', public: false) } @@ -124,7 +124,7 @@ describe 'Projects > Settings > Repository settings' do let(:user2) { create(:user) } before do - project.add_master(user2) + project.add_maintainer(user2) visit project_settings_repository_path(project) end diff --git a/spec/features/projects/settings/user_archives_project_spec.rb b/spec/features/projects/settings/user_archives_project_spec.rb index 38c8a8c2468..5008eab4d39 100644 --- a/spec/features/projects/settings/user_archives_project_spec.rb +++ b/spec/features/projects/settings/user_archives_project_spec.rb @@ -4,7 +4,7 @@ describe 'Projects > Settings > User archives a project' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/projects/settings/user_changes_avatar_spec.rb b/spec/features/projects/settings/user_changes_avatar_spec.rb index 2dcc79d8a12..64335163016 100644 --- a/spec/features/projects/settings/user_changes_avatar_spec.rb +++ b/spec/features/projects/settings/user_changes_avatar_spec.rb @@ -5,7 +5,7 @@ describe 'Projects > Settings > User changes avatar' do let(:user) { project.creator } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb b/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb index 71a077039b7..ecfb49b9efe 100644 --- a/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb +++ b/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb @@ -50,7 +50,7 @@ describe "User interacts with deploy keys", :js do before do create(:deploy_keys_project, project: another_project, deploy_key: deploy_key) - another_project.add_master(user) + another_project.add_maintainer(user) end it "shows deploy keys" do @@ -110,7 +110,7 @@ describe "User interacts with deploy keys", :js do before do create(:deploy_keys_project, project: another_project, deploy_key: deploy_key) - another_project.add_master(user) + another_project.add_maintainer(user) end it_behaves_like "attaches a key" diff --git a/spec/features/projects/settings/user_manages_group_links_spec.rb b/spec/features/projects/settings/user_manages_group_links_spec.rb index 92ce2ca83c7..2f1824d7849 100644 --- a/spec/features/projects/settings/user_manages_group_links_spec.rb +++ b/spec/features/projects/settings/user_manages_group_links_spec.rb @@ -9,10 +9,10 @@ describe 'Projects > Settings > User manages group links' do let(:group_market) { create(:group, name: 'Market', path: 'market') } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) - share_link = project.project_group_links.new(group_access: Gitlab::Access::MASTER) + share_link = project.project_group_links.new(group_access: Gitlab::Access::MAINTAINER) share_link.group_id = group_ops.id share_link.save! diff --git a/spec/features/projects/settings/user_manages_project_members_spec.rb b/spec/features/projects/settings/user_manages_project_members_spec.rb index d3003753ae6..b8ca11d53f0 100644 --- a/spec/features/projects/settings/user_manages_project_members_spec.rb +++ b/spec/features/projects/settings/user_manages_project_members_spec.rb @@ -9,7 +9,7 @@ describe 'Projects > Settings > User manages project members' do let(:user_mike) { create(:user, name: 'Mike') } before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user_dmitriy) sign_in(user) end @@ -30,7 +30,7 @@ describe 'Projects > Settings > User manages project members' do end it 'imports a team from another project' do - project2.add_master(user) + project2.add_maintainer(user) project2.add_reporter(user_mike) visit(project_project_members_path(project)) @@ -54,7 +54,7 @@ describe 'Projects > Settings > User manages project members' do group.add_owner(user) group.add_developer(user_dmitriy) - share_link = project.project_group_links.new(group_access: Gitlab::Access::MASTER) + share_link = project.project_group_links.new(group_access: Gitlab::Access::MAINTAINER) share_link.group_id = group.id share_link.save! diff --git a/spec/features/projects/settings/visibility_settings_spec.rb b/spec/features/projects/settings/visibility_settings_spec.rb index 2ec6990313f..1fbc108697f 100644 --- a/spec/features/projects/settings/visibility_settings_spec.rb +++ b/spec/features/projects/settings/visibility_settings_spec.rb @@ -59,12 +59,12 @@ describe 'Projects > Settings > Visibility settings', :js do end end - context 'as master' do - let(:master_user) { create(:user) } + context 'as maintainer' do + let(:maintainer_user) { create(:user) } before do - project.add_master(master_user) - sign_in(master_user) + project.add_maintainer(maintainer_user) + sign_in(maintainer_user) visit edit_project_path(project) end diff --git a/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb b/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb index 7b9242f0631..0405e21a0d7 100644 --- a/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb +++ b/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb @@ -38,9 +38,9 @@ describe 'Projects > Show > User sees setup shortcut buttons' do end end - describe 'as a master' do + describe 'as a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_path(project) @@ -138,10 +138,10 @@ describe 'Projects > Show > User sees setup shortcut buttons' do end end - describe 'as a master' do + describe 'as a maintainer' do before do allow_any_instance_of(AutoDevopsHelper).to receive(:show_auto_devops_callout?).and_return(false) - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/snippets/create_snippet_spec.rb b/spec/features/projects/snippets/create_snippet_spec.rb index 2388feeb980..6d8a72dd6a3 100644 --- a/spec/features/projects/snippets/create_snippet_spec.rb +++ b/spec/features/projects/snippets/create_snippet_spec.rb @@ -16,7 +16,7 @@ describe 'Projects > Snippets > Create Snippet', :js do context 'when a user is authenticated' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_snippets_path(project) diff --git a/spec/features/projects/snippets/show_spec.rb b/spec/features/projects/snippets/show_spec.rb index 004ac55b656..3cc797277dd 100644 --- a/spec/features/projects/snippets/show_spec.rb +++ b/spec/features/projects/snippets/show_spec.rb @@ -6,7 +6,7 @@ describe 'Projects > Snippets > Project snippet', :js do let(:snippet) { create(:project_snippet, project: project, file_name: file_name, content: content) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb index 01cf9740d1f..d82e350e0f7 100644 --- a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb +++ b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb @@ -6,7 +6,7 @@ describe 'Projects > Snippets > User comments on a snippet', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_snippet_path(project, snippet)) diff --git a/spec/features/projects/snippets/user_deletes_snippet_spec.rb b/spec/features/projects/snippets/user_deletes_snippet_spec.rb index e64837ad59e..2bd8bb9d551 100644 --- a/spec/features/projects/snippets/user_deletes_snippet_spec.rb +++ b/spec/features/projects/snippets/user_deletes_snippet_spec.rb @@ -6,7 +6,7 @@ describe 'Projects > Snippets > User deletes a snippet' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_snippet_path(project, snippet)) diff --git a/spec/features/projects/snippets/user_updates_snippet_spec.rb b/spec/features/projects/snippets/user_updates_snippet_spec.rb index eaedbbf32b6..33f77d55f89 100644 --- a/spec/features/projects/snippets/user_updates_snippet_spec.rb +++ b/spec/features/projects/snippets/user_updates_snippet_spec.rb @@ -6,7 +6,7 @@ describe 'Projects > Snippets > User updates a snippet' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_snippet_path(project, snippet)) diff --git a/spec/features/projects/snippets/user_views_snippets_spec.rb b/spec/features/projects/snippets/user_views_snippets_spec.rb index 376b76e0001..1243db9d9f7 100644 --- a/spec/features/projects/snippets/user_views_snippets_spec.rb +++ b/spec/features/projects/snippets/user_views_snippets_spec.rb @@ -8,7 +8,7 @@ describe 'Projects > Snippets > User views snippets' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_snippets_path(project)) diff --git a/spec/features/projects/sub_group_issuables_spec.rb b/spec/features/projects/sub_group_issuables_spec.rb index eb2d3ff50a0..50e7e934cf6 100644 --- a/spec/features/projects/sub_group_issuables_spec.rb +++ b/spec/features/projects/sub_group_issuables_spec.rb @@ -7,7 +7,7 @@ describe 'Subgroup Issuables', :js, :nested_groups do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in user end diff --git a/spec/features/projects/tree/create_directory_spec.rb b/spec/features/projects/tree/create_directory_spec.rb index d0902bce7f3..057b49cc68c 100644 --- a/spec/features/projects/tree/create_directory_spec.rb +++ b/spec/features/projects/tree/create_directory_spec.rb @@ -5,7 +5,7 @@ describe 'Multi-file editor new directory', :js do let(:project) { create(:project, :repository) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_tree_path(project, :master) diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb index 03a29fae0bd..b324ab01383 100644 --- a/spec/features/projects/tree/create_file_spec.rb +++ b/spec/features/projects/tree/create_file_spec.rb @@ -5,7 +5,7 @@ describe 'Multi-file editor new file', :js do let(:project) { create(:project, :repository) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_path(project) diff --git a/spec/features/projects/tree/tree_show_spec.rb b/spec/features/projects/tree/tree_show_spec.rb index dc59666ffce..9e15163fd72 100644 --- a/spec/features/projects/tree/tree_show_spec.rb +++ b/spec/features/projects/tree/tree_show_spec.rb @@ -5,7 +5,7 @@ describe 'Projects tree' do let(:project) { create(:project, :repository) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_tree_path(project, 'master') diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb index 804a4450ae2..28da0a87f22 100644 --- a/spec/features/projects/tree/upload_file_spec.rb +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -7,7 +7,7 @@ describe 'Multi-file editor upload file', :js do let(:img_file) { File.join(Rails.root, 'spec', 'fixtures', 'dk.png') } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_tree_path(project, :master) diff --git a/spec/features/projects/user_uses_shortcuts_spec.rb b/spec/features/projects/user_uses_shortcuts_spec.rb index c8b3104b9fe..df9ee69aadb 100644 --- a/spec/features/projects/user_uses_shortcuts_spec.rb +++ b/spec/features/projects/user_uses_shortcuts_spec.rb @@ -5,7 +5,7 @@ describe 'User uses shortcuts', :js do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_path(project)) diff --git a/spec/features/projects/user_views_empty_project_spec.rb b/spec/features/projects/user_views_empty_project_spec.rb index 7b982301ffc..b7c0834d33a 100644 --- a/spec/features/projects/user_views_empty_project_spec.rb +++ b/spec/features/projects/user_views_empty_project_spec.rb @@ -15,9 +15,9 @@ describe 'User views an empty project' do end end - describe 'as a master' do + describe 'as a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'allowing push to default branch' diff --git a/spec/features/projects/view_on_env_spec.rb b/spec/features/projects/view_on_env_spec.rb index 84ec32b3fac..a48ad94e9fa 100644 --- a/spec/features/projects/view_on_env_spec.rb +++ b/spec/features/projects/view_on_env_spec.rb @@ -7,7 +7,7 @@ describe 'View on environment', :js do let(:user) { project.creator } before do - project.add_master(user) + project.add_maintainer(user) end context 'when the branch has a route map' do diff --git a/spec/features/projects/wiki/markdown_preview_spec.rb b/spec/features/projects/wiki/markdown_preview_spec.rb index 0bec5f185d6..ed5f8105487 100644 --- a/spec/features/projects/wiki/markdown_preview_spec.rb +++ b/spec/features/projects/wiki/markdown_preview_spec.rb @@ -14,7 +14,7 @@ describe 'Projects > Wiki > User previews markdown changes', :js do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index 733e6c89de7..830565620d6 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -4,7 +4,7 @@ describe "User creates wiki page" do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(project_wikis_path(project)) diff --git a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb index 2ccbc15b6da..2840d28cf30 100644 --- a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb @@ -4,7 +4,7 @@ describe 'User updates wiki page' do shared_examples 'wiki page user update' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb index 92b50169476..fb0ebe22bf7 100644 --- a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb @@ -4,7 +4,7 @@ describe 'Projects > Wiki > User views wiki in project page' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/wiki/user_views_wiki_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_page_spec.rb index 1de7d9a56a8..0ef7f35f64a 100644 --- a/spec/features/projects/wiki/user_views_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_page_spec.rb @@ -11,7 +11,7 @@ describe 'User views a wiki page' do end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 8636d17f2c4..00946bccd9a 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -151,7 +151,7 @@ describe 'Project' do before do sign_in(user) - project.add_master(user) + project.add_maintainer(user) visit edit_project_path(project) end @@ -169,7 +169,7 @@ describe 'Project' do let(:project) { create(:forked_project_with_submodules) } before do - project.add_master(user) + project.add_maintainer(user) sign_in user visit project_path(project) end @@ -198,7 +198,7 @@ describe 'Project' do let(:project) { create(:project, :repository) } before do - project.add_master(user) + project.add_maintainer(user) sign_in user visit project_path(project) end diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index 83a5f88f0b5..63c38a25f4b 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -28,9 +28,9 @@ describe 'Protected Branches', :js do end end - context 'logged in as master' do + context 'logged in as maintainer' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/reportable_note/commit_spec.rb b/spec/features/reportable_note/commit_spec.rb index 9b6864eb90f..54ebda9dcab 100644 --- a/spec/features/reportable_note/commit_spec.rb +++ b/spec/features/reportable_note/commit_spec.rb @@ -7,7 +7,7 @@ describe 'Reportable note on commit', :js do let(:project) { create(:project, :repository) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/reportable_note/issue_spec.rb b/spec/features/reportable_note/issue_spec.rb index f5a1950e48e..bce1f7a3780 100644 --- a/spec/features/reportable_note/issue_spec.rb +++ b/spec/features/reportable_note/issue_spec.rb @@ -7,7 +7,7 @@ describe 'Reportable note on issue', :js do let!(:note) { create(:note_on_issue, noteable: issue, project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_issue_path(project, issue) diff --git a/spec/features/reportable_note/merge_request_spec.rb b/spec/features/reportable_note/merge_request_spec.rb index 1f69257f7ed..d00324156c4 100644 --- a/spec/features/reportable_note/merge_request_spec.rb +++ b/spec/features/reportable_note/merge_request_spec.rb @@ -6,7 +6,7 @@ describe 'Reportable note on merge request', :js do let(:merge_request) { create(:merge_request, source_project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_merge_request_path(project, merge_request) diff --git a/spec/features/reportable_note/snippets_spec.rb b/spec/features/reportable_note/snippets_spec.rb index 98ef50b78de..06218d9b286 100644 --- a/spec/features/reportable_note/snippets_spec.rb +++ b/spec/features/reportable_note/snippets_spec.rb @@ -5,7 +5,7 @@ describe 'Reportable note on snippets', :js do let(:project) { create(:project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb index 443c2b9acae..0c6cf3dc477 100644 --- a/spec/features/runners_spec.rb +++ b/spec/features/runners_spec.rb @@ -11,7 +11,7 @@ describe 'Runners' do let(:project) { create(:project) } before do - project.add_master(user) + project.add_maintainer(user) end it 'user can see a button to install runners on kubernetes clusters' do @@ -25,7 +25,7 @@ describe 'Runners' do let(:project) { create(:project) } before do - project.add_master(user) + project.add_maintainer(user) end context 'when a project_type runner is activated on the project' do @@ -125,7 +125,7 @@ describe 'Runners' do let!(:specific_runner) { create(:ci_runner, :project, projects: [another_project]) } before do - another_project.add_master(user) + another_project.add_maintainer(user) end it 'user enables and disables a specific runner' do @@ -165,7 +165,7 @@ describe 'Runners' do let(:project) { create(:project, shared_runners_enabled: false) } before do - project.add_master(user) + project.add_maintainer(user) end it 'user enables shared runners' do @@ -179,14 +179,14 @@ describe 'Runners' do context 'group runners in project settings' do before do - project.add_master(user) + project.add_maintainer(user) end let(:group) { create :group } context 'as project and group maintainer' do before do - group.add_master(user) + group.add_maintainer(user) end context 'project with a group but no group runner' do @@ -260,7 +260,7 @@ describe 'Runners' do context 'group runners in group settings' do let(:group) { create(:group) } before do - group.add_master(user) + group.add_maintainer(user) end context 'group with no runners' do diff --git a/spec/features/search/user_searches_for_code_spec.rb b/spec/features/search/user_searches_for_code_spec.rb index 9e089c5a6cb..ecec2f3e043 100644 --- a/spec/features/search/user_searches_for_code_spec.rb +++ b/spec/features/search/user_searches_for_code_spec.rb @@ -6,7 +6,7 @@ describe 'User searches for code' do context 'when signed in' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/search/user_searches_for_issues_spec.rb b/spec/features/search/user_searches_for_issues_spec.rb index d6120ff8517..4bff269f89e 100644 --- a/spec/features/search/user_searches_for_issues_spec.rb +++ b/spec/features/search/user_searches_for_issues_spec.rb @@ -8,7 +8,7 @@ describe 'User searches for issues', :js do context 'when signed in' do before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(search_path) diff --git a/spec/features/search/user_searches_for_merge_requests_spec.rb b/spec/features/search/user_searches_for_merge_requests_spec.rb index 68e2f7a857d..75d44e413cb 100644 --- a/spec/features/search/user_searches_for_merge_requests_spec.rb +++ b/spec/features/search/user_searches_for_merge_requests_spec.rb @@ -7,7 +7,7 @@ describe 'User searches for merge requests', :js do let!(:merge_request2) { create(:merge_request, :simple, title: 'Bar', source_project: project, target_project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(search_path) diff --git a/spec/features/search/user_searches_for_milestones_spec.rb b/spec/features/search/user_searches_for_milestones_spec.rb index fc6cd81eb68..7d52c4c8bcc 100644 --- a/spec/features/search/user_searches_for_milestones_spec.rb +++ b/spec/features/search/user_searches_for_milestones_spec.rb @@ -7,7 +7,7 @@ describe 'User searches for milestones', :js do let!(:milestone2) { create(:milestone, title: 'Bar', project: project) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(search_path) diff --git a/spec/features/search/user_searches_for_wiki_pages_spec.rb b/spec/features/search/user_searches_for_wiki_pages_spec.rb index 5098fb49ee1..3ee753b7d23 100644 --- a/spec/features/search/user_searches_for_wiki_pages_spec.rb +++ b/spec/features/search/user_searches_for_wiki_pages_spec.rb @@ -6,7 +6,7 @@ describe 'User searches for wiki pages', :js do let!(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'test_wiki', content: 'Some Wiki content' }) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit(search_path) diff --git a/spec/features/security/group/internal_access_spec.rb b/spec/features/security/group/internal_access_spec.rb index 5067f0b0a49..51b32ba6c03 100644 --- a/spec/features/security/group/internal_access_spec.rb +++ b/spec/features/security/group/internal_access_spec.rb @@ -23,7 +23,7 @@ describe 'Internal Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -38,7 +38,7 @@ describe 'Internal Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -54,7 +54,7 @@ describe 'Internal Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -69,7 +69,7 @@ describe 'Internal Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -84,7 +84,7 @@ describe 'Internal Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_denied_for(:master).of(group) } + it { is_expected.to be_denied_for(:maintainer).of(group) } it { is_expected.to be_denied_for(:developer).of(group) } it { is_expected.to be_denied_for(:reporter).of(group) } it { is_expected.to be_denied_for(:guest).of(group) } diff --git a/spec/features/security/group/private_access_spec.rb b/spec/features/security/group/private_access_spec.rb index ff32413dc7e..4705cd12d23 100644 --- a/spec/features/security/group/private_access_spec.rb +++ b/spec/features/security/group/private_access_spec.rb @@ -23,7 +23,7 @@ describe 'Private Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -38,7 +38,7 @@ describe 'Private Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -54,7 +54,7 @@ describe 'Private Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -69,7 +69,7 @@ describe 'Private Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -84,7 +84,7 @@ describe 'Private Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_denied_for(:master).of(group) } + it { is_expected.to be_denied_for(:maintainer).of(group) } it { is_expected.to be_denied_for(:developer).of(group) } it { is_expected.to be_denied_for(:reporter).of(group) } it { is_expected.to be_denied_for(:guest).of(group) } diff --git a/spec/features/security/group/public_access_spec.rb b/spec/features/security/group/public_access_spec.rb index 16d114fb3f7..3a53c3c2bc7 100644 --- a/spec/features/security/group/public_access_spec.rb +++ b/spec/features/security/group/public_access_spec.rb @@ -23,7 +23,7 @@ describe 'Public Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -38,7 +38,7 @@ describe 'Public Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -54,7 +54,7 @@ describe 'Public Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -69,7 +69,7 @@ describe 'Public Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_allowed_for(:master).of(group) } + it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:developer).of(group) } it { is_expected.to be_allowed_for(:reporter).of(group) } it { is_expected.to be_allowed_for(:guest).of(group) } @@ -84,7 +84,7 @@ describe 'Public Group access' do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(group) } - it { is_expected.to be_denied_for(:master).of(group) } + it { is_expected.to be_denied_for(:maintainer).of(group) } it { is_expected.to be_denied_for(:developer).of(group) } it { is_expected.to be_denied_for(:reporter).of(group) } it { is_expected.to be_denied_for(:guest).of(group) } diff --git a/spec/features/security/project/internal_access_spec.rb b/spec/features/security/project/internal_access_spec.rb index a7928857b7d..001e6c10eb2 100644 --- a/spec/features/security/project/internal_access_spec.rb +++ b/spec/features/security/project/internal_access_spec.rb @@ -17,7 +17,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -31,7 +31,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -45,7 +45,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -59,7 +59,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -73,7 +73,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -87,7 +87,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -101,7 +101,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -115,7 +115,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -130,7 +130,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -144,7 +144,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -158,7 +158,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -172,7 +172,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -187,7 +187,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -201,7 +201,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -215,7 +215,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -229,7 +229,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -243,7 +243,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -262,7 +262,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -281,7 +281,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -295,7 +295,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -309,7 +309,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -324,7 +324,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -343,7 +343,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -359,7 +359,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -381,7 +381,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -397,7 +397,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -419,7 +419,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -435,7 +435,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -450,7 +450,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -464,7 +464,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -479,7 +479,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -494,7 +494,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -508,7 +508,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -530,7 +530,7 @@ describe "Internal Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } diff --git a/spec/features/security/project/private_access_spec.rb b/spec/features/security/project/private_access_spec.rb index a4396b20afd..c6618355eea 100644 --- a/spec/features/security/project/private_access_spec.rb +++ b/spec/features/security/project/private_access_spec.rb @@ -17,7 +17,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -31,7 +31,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -45,7 +45,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -59,7 +59,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -73,7 +73,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -87,7 +87,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -101,7 +101,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -115,7 +115,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -130,7 +130,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -144,7 +144,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -158,7 +158,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -172,7 +172,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -187,7 +187,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -201,7 +201,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -215,7 +215,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -234,7 +234,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -253,7 +253,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -267,7 +267,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -281,7 +281,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -308,7 +308,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -334,7 +334,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -362,7 +362,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -395,7 +395,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -425,7 +425,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -440,7 +440,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -455,7 +455,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -469,7 +469,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -483,7 +483,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -497,7 +497,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -511,7 +511,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -533,7 +533,7 @@ describe "Private Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } diff --git a/spec/features/security/project/public_access_spec.rb b/spec/features/security/project/public_access_spec.rb index fccdeb0e5b7..3717dc13f1e 100644 --- a/spec/features/security/project/public_access_spec.rb +++ b/spec/features/security/project/public_access_spec.rb @@ -17,7 +17,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -31,7 +31,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -45,7 +45,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -59,7 +59,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -73,7 +73,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -87,7 +87,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -101,7 +101,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -115,7 +115,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -129,7 +129,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -144,7 +144,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -163,7 +163,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -179,7 +179,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -201,7 +201,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -217,7 +217,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -239,7 +239,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -255,7 +255,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -270,7 +270,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -284,7 +284,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -299,7 +299,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -314,7 +314,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -328,7 +328,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -344,7 +344,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -357,7 +357,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -371,7 +371,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -385,7 +385,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -400,7 +400,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -414,7 +414,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -428,7 +428,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -442,7 +442,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -456,7 +456,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -475,7 +475,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -494,7 +494,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -508,7 +508,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_denied_for(:developer).of(project) } it { is_expected.to be_denied_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -530,7 +530,7 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } diff --git a/spec/features/security/project/snippet/internal_access_spec.rb b/spec/features/security/project/snippet/internal_access_spec.rb index d7dc99c0a57..b87eb86b88b 100644 --- a/spec/features/security/project/snippet/internal_access_spec.rb +++ b/spec/features/security/project/snippet/internal_access_spec.rb @@ -13,7 +13,7 @@ describe "Internal Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -27,7 +27,7 @@ describe "Internal Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -42,7 +42,7 @@ describe "Internal Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -56,7 +56,7 @@ describe "Internal Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -72,7 +72,7 @@ describe "Internal Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -86,7 +86,7 @@ describe "Internal Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } diff --git a/spec/features/security/project/snippet/private_access_spec.rb b/spec/features/security/project/snippet/private_access_spec.rb index 3ec1a388185..ead91d9a5fa 100644 --- a/spec/features/security/project/snippet/private_access_spec.rb +++ b/spec/features/security/project/snippet/private_access_spec.rb @@ -12,7 +12,7 @@ describe "Private Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -26,7 +26,7 @@ describe "Private Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -40,7 +40,7 @@ describe "Private Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -54,7 +54,7 @@ describe "Private Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } diff --git a/spec/features/security/project/snippet/public_access_spec.rb b/spec/features/security/project/snippet/public_access_spec.rb index 39b104bfe27..9bab3a474b8 100644 --- a/spec/features/security/project/snippet/public_access_spec.rb +++ b/spec/features/security/project/snippet/public_access_spec.rb @@ -14,7 +14,7 @@ describe "Public Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -28,7 +28,7 @@ describe "Public Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_denied_for(:guest).of(project) } @@ -43,7 +43,7 @@ describe "Public Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -57,7 +57,7 @@ describe "Public Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -71,7 +71,7 @@ describe "Public Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -87,7 +87,7 @@ describe "Public Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -101,7 +101,7 @@ describe "Public Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } @@ -115,7 +115,7 @@ describe "Public Project Snippets Access" do it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:maintainer).of(project) } it { is_expected.to be_allowed_for(:developer).of(project) } it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } diff --git a/spec/features/signed_commits_spec.rb b/spec/features/signed_commits_spec.rb index bc9443c6093..3d05474dca2 100644 --- a/spec/features/signed_commits_spec.rb +++ b/spec/features/signed_commits_spec.rb @@ -5,7 +5,7 @@ describe 'GPG signed commits', :js do it 'changes from unverified to verified when the user changes his email to match the gpg key' do user = create :user, email: 'unrelated.user@example.org' - project.add_master(user) + project.add_maintainer(user) Sidekiq::Testing.inline! do create :gpg_key, key: GpgHelpers::User1.public_key, user: user @@ -36,7 +36,7 @@ describe 'GPG signed commits', :js do it 'changes from unverified to verified when the user adds the missing gpg key' do user = create :user, email: GpgHelpers::User1.emails.first - project.add_master(user) + project.add_maintainer(user) sign_in(user) @@ -86,7 +86,7 @@ describe 'GPG signed commits', :js do before do user = create :user - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb index b4e8253057b..db2970f3340 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe 'Master creates tag' do +describe 'Maintainer creates tag' do let(:user) { create(:user) } let(:project) { create(:project, :repository, namespace: user.namespace) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/tags/master_deletes_tag_spec.rb b/spec/features/tags/master_deletes_tag_spec.rb index 1443e259ed9..8d567e925ef 100644 --- a/spec/features/tags/master_deletes_tag_spec.rb +++ b/spec/features/tags/master_deletes_tag_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe 'Master deletes tag' do +describe 'Maintainer deletes tag' do let(:user) { create(:user) } let(:project) { create(:project, :repository, namespace: user.namespace) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_tags_path(project) end diff --git a/spec/features/tags/master_updates_tag_spec.rb b/spec/features/tags/master_updates_tag_spec.rb index 4c0be6be96c..d8b5b3c4cc4 100644 --- a/spec/features/tags/master_updates_tag_spec.rb +++ b/spec/features/tags/master_updates_tag_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe 'Master updates tag' do +describe 'Maintainer updates tag' do let(:user) { create(:user) } let(:project) { create(:project, :repository, namespace: user.namespace) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) visit project_tags_path(project) end diff --git a/spec/features/tags/master_views_tags_spec.rb b/spec/features/tags/master_views_tags_spec.rb index 02ce0242614..3f4fe549f3e 100644 --- a/spec/features/tags/master_views_tags_spec.rb +++ b/spec/features/tags/master_views_tags_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -describe 'Master views tags' do +describe 'Maintainer views tags' do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb index 64d05c57d3c..9c9127980a1 100644 --- a/spec/features/task_lists_spec.rb +++ b/spec/features/task_lists_spec.rb @@ -65,7 +65,7 @@ describe 'Task Lists' do before do Warden.test_mode! - project.add_master(user) + project.add_maintainer(user) project.add_guest(user2) login_as(user) diff --git a/spec/features/triggers_spec.rb b/spec/features/triggers_spec.rb index 36dafccd186..919859c145a 100644 --- a/spec/features/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -10,8 +10,8 @@ describe 'Triggers', :js do sign_in(user) @project = create(:project) - @project.add_master(user) - @project.add_master(user2) + @project.add_maintainer(user) + @project.add_maintainer(user2) @project.add_guest(guest_user) visit project_settings_ci_cd_path(@project) diff --git a/spec/features/users/user_browses_projects_on_user_page_spec.rb b/spec/features/users/user_browses_projects_on_user_page_spec.rb index 5478e38ce70..6a9b281fb4c 100644 --- a/spec/features/users/user_browses_projects_on_user_page_spec.rb +++ b/spec/features/users/user_browses_projects_on_user_page_spec.rb @@ -4,19 +4,19 @@ describe 'Users > User browses projects on user page', :js do let!(:user) { create :user } let!(:private_project) do create :project, :private, name: 'private', namespace: user.namespace do |project| - project.add_master(user) + project.add_maintainer(user) end end let!(:internal_project) do create :project, :internal, name: 'internal', namespace: user.namespace do |project| - project.add_master(user) + project.add_maintainer(user) end end let!(:public_project) do create :project, :public, name: 'public', namespace: user.namespace do |project| - project.add_master(user) + project.add_maintainer(user) end end diff --git a/spec/finders/access_requests_finder_spec.rb b/spec/finders/access_requests_finder_spec.rb index 650f7229647..605777462bb 100644 --- a/spec/finders/access_requests_finder_spec.rb +++ b/spec/finders/access_requests_finder_spec.rb @@ -51,7 +51,7 @@ describe AccessRequestsFinder do context 'when current user can see access requests' do before do - project.add_master(user) + project.add_maintainer(user) group.add_owner(user) end @@ -78,7 +78,7 @@ describe AccessRequestsFinder do context 'when current user can see access requests' do before do - project.add_master(user) + project.add_maintainer(user) group.add_owner(user) end diff --git a/spec/finders/admin/projects_finder_spec.rb b/spec/finders/admin/projects_finder_spec.rb index 7901d5fee28..44cc8debd04 100644 --- a/spec/finders/admin/projects_finder_spec.rb +++ b/spec/finders/admin/projects_finder_spec.rb @@ -54,7 +54,7 @@ describe Admin::ProjectsFinder do context 'filter by visibility_level' do before do - private_project.add_master(user) + private_project.add_maintainer(user) end context 'private' do diff --git a/spec/finders/concerns/finder_with_cross_project_access_spec.rb b/spec/finders/concerns/finder_with_cross_project_access_spec.rb index c784fb87972..1ff65a8101b 100644 --- a/spec/finders/concerns/finder_with_cross_project_access_spec.rb +++ b/spec/finders/concerns/finder_with_cross_project_access_spec.rb @@ -25,7 +25,7 @@ describe FinderWithCrossProjectAccess do let!(:result) { create(:issue) } before do - result.project.add_master(user) + result.project.add_maintainer(user) end def expect_access_check_on_result diff --git a/spec/finders/contributed_projects_finder_spec.rb b/spec/finders/contributed_projects_finder_spec.rb index 60ea98e61c7..9155a8d6fe9 100644 --- a/spec/finders/contributed_projects_finder_spec.rb +++ b/spec/finders/contributed_projects_finder_spec.rb @@ -10,9 +10,9 @@ describe ContributedProjectsFinder do let!(:private_project) { create(:project, :private) } before do - private_project.add_master(source_user) + private_project.add_maintainer(source_user) private_project.add_developer(current_user) - public_project.add_master(source_user) + public_project.add_maintainer(source_user) create(:push_event, project: public_project, author: source_user) create(:push_event, project: private_project, author: source_user) diff --git a/spec/finders/environments_finder_spec.rb b/spec/finders/environments_finder_spec.rb index 3a8a1e7de74..3cd421f22eb 100644 --- a/spec/finders/environments_finder_spec.rb +++ b/spec/finders/environments_finder_spec.rb @@ -7,7 +7,7 @@ describe EnvironmentsFinder do let(:environment) { create(:environment, project: project) } before do - project.add_master(user) + project.add_maintainer(user) end context 'tagged deployment' do diff --git a/spec/finders/group_members_finder_spec.rb b/spec/finders/group_members_finder_spec.rb index 63e15b365a4..f545da3aee4 100644 --- a/spec/finders/group_members_finder_spec.rb +++ b/spec/finders/group_members_finder_spec.rb @@ -9,9 +9,9 @@ describe GroupMembersFinder, '#execute' do let(:user4) { create(:user) } it 'returns members for top-level group' do - member1 = group.add_master(user1) - member2 = group.add_master(user2) - member3 = group.add_master(user3) + member1 = group.add_maintainer(user1) + member2 = group.add_maintainer(user2) + member3 = group.add_maintainer(user3) result = described_class.new(group).execute @@ -19,11 +19,11 @@ describe GroupMembersFinder, '#execute' do end it 'returns members for nested group', :nested_groups do - group.add_master(user2) + group.add_maintainer(user2) nested_group.request_access(user4) - member1 = group.add_master(user1) - member3 = nested_group.add_master(user2) - member4 = nested_group.add_master(user3) + member1 = group.add_maintainer(user1) + member3 = nested_group.add_maintainer(user2) + member4 = nested_group.add_maintainer(user3) result = described_class.new(nested_group).execute @@ -31,11 +31,11 @@ describe GroupMembersFinder, '#execute' do end it 'returns members for descendant groups if requested', :nested_groups do - member1 = group.add_master(user2) - member2 = group.add_master(user1) - nested_group.add_master(user2) - member3 = nested_group.add_master(user3) - member4 = nested_group.add_master(user4) + member1 = group.add_maintainer(user2) + member2 = group.add_maintainer(user1) + nested_group.add_maintainer(user2) + member3 = nested_group.add_maintainer(user3) + member4 = nested_group.add_maintainer(user4) result = described_class.new(group).execute(include_descendants: true) diff --git a/spec/finders/group_projects_finder_spec.rb b/spec/finders/group_projects_finder_spec.rb index 0a69c03e491..d6d95906f5e 100644 --- a/spec/finders/group_projects_finder_spec.rb +++ b/spec/finders/group_projects_finder_spec.rb @@ -17,16 +17,16 @@ describe GroupProjectsFinder do let!(:subgroup_private_project) { create(:project, :private, path: '7', group: subgroup) } before do - shared_project_1.project_group_links.create(group_access: Gitlab::Access::MASTER, group: group) - shared_project_2.project_group_links.create(group_access: Gitlab::Access::MASTER, group: group) - shared_project_3.project_group_links.create(group_access: Gitlab::Access::MASTER, group: group) + shared_project_1.project_group_links.create(group_access: Gitlab::Access::MAINTAINER, group: group) + shared_project_2.project_group_links.create(group_access: Gitlab::Access::MAINTAINER, group: group) + shared_project_3.project_group_links.create(group_access: Gitlab::Access::MAINTAINER, group: group) end subject { finder.execute } describe 'with a group member current user' do before do - group.add_master(current_user) + group.add_maintainer(current_user) end context "only shared" do @@ -68,7 +68,7 @@ describe GroupProjectsFinder do describe 'without group member current_user' do before do - shared_project_2.add_master(current_user) + shared_project_2.add_maintainer(current_user) current_user.reload end @@ -93,8 +93,8 @@ describe GroupProjectsFinder do context "without external user" do before do - private_project.add_master(current_user) - subgroup_private_project.add_master(current_user) + private_project.add_maintainer(current_user) + subgroup_private_project.add_maintainer(current_user) end context 'with subgroups projects', :nested_groups do diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index 74e91b02f0f..07a2fa86dd7 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -26,7 +26,7 @@ describe IssuesFinder do let(:issues) { described_class.new(search_user, params.reverse_merge(scope: scope, state: 'opened')).execute } before(:context) do - project1.add_master(user) + project1.add_maintainer(user) project2.add_developer(user) project2.add_developer(user2) project3.add_developer(user) diff --git a/spec/finders/joined_groups_finder_spec.rb b/spec/finders/joined_groups_finder_spec.rb index 7f77a713b12..ae3e55f90f1 100644 --- a/spec/finders/joined_groups_finder_spec.rb +++ b/spec/finders/joined_groups_finder_spec.rb @@ -15,7 +15,7 @@ describe JoinedGroupsFinder do context 'without a user' do before do - public_group.add_master(profile_owner) + public_group.add_maintainer(profile_owner) end it 'only shows public groups from profile owner' do @@ -25,9 +25,9 @@ describe JoinedGroupsFinder do context "with a user" do before do - private_group.add_master(profile_owner) - internal_group.add_master(profile_owner) - public_group.add_master(profile_owner) + private_group.add_maintainer(profile_owner) + internal_group.add_maintainer(profile_owner) + public_group.add_maintainer(profile_owner) end context "when the profile visitor is in the private group" do @@ -64,7 +64,7 @@ describe JoinedGroupsFinder do context "if authorized" do before do - internal_group.add_master(profile_visitor) + internal_group.add_maintainer(profile_visitor) end it "shows internal groups if authorized" do diff --git a/spec/finders/members_finder_spec.rb b/spec/finders/members_finder_spec.rb index 2fc5299b0f4..db48f00cd74 100644 --- a/spec/finders/members_finder_spec.rb +++ b/spec/finders/members_finder_spec.rb @@ -11,9 +11,9 @@ describe MembersFinder, '#execute' do it 'returns members for project and parent groups', :nested_groups do nested_group.request_access(user1) - member1 = group.add_master(user2) - member2 = nested_group.add_master(user3) - member3 = project.add_master(user4) + member1 = group.add_maintainer(user2) + member2 = nested_group.add_maintainer(user3) + member3 = project.add_maintainer(user4) result = described_class.new(project, user2).execute @@ -23,9 +23,9 @@ describe MembersFinder, '#execute' do it 'includes nested group members if asked', :nested_groups do project = create(:project, namespace: group) nested_group.request_access(user1) - member1 = group.add_master(user2) - member2 = nested_group.add_master(user3) - member3 = project.add_master(user4) + member1 = group.add_maintainer(user2) + member2 = nested_group.add_maintainer(user3) + member3 = project.add_maintainer(user4) result = described_class.new(project, user2).execute(include_descendants: true) diff --git a/spec/finders/merge_requests_finder_spec.rb b/spec/finders/merge_requests_finder_spec.rb index 669ec602f11..35d0eeda8f6 100644 --- a/spec/finders/merge_requests_finder_spec.rb +++ b/spec/finders/merge_requests_finder_spec.rb @@ -24,7 +24,7 @@ describe MergeRequestsFinder do let!(:merge_request5) { create(:merge_request, :simple, author: user, source_project: project4, target_project: project4) } before do - project1.add_master(user) + project1.add_maintainer(user) project2.add_developer(user) project3.add_developer(user) project2.add_developer(user2) @@ -142,7 +142,7 @@ describe MergeRequestsFinder do end before do - new_project.add_master(user) + new_project.add_maintainer(user) end it 'filters by created_after' do diff --git a/spec/finders/move_to_project_finder_spec.rb b/spec/finders/move_to_project_finder_spec.rb index e1faf3d569c..1511cb0e04c 100644 --- a/spec/finders/move_to_project_finder_spec.rb +++ b/spec/finders/move_to_project_finder_spec.rb @@ -8,7 +8,7 @@ describe MoveToProjectFinder do let(:guest_project) { create(:project) } let(:reporter_project) { create(:project) } let(:developer_project) { create(:project) } - let(:master_project) { create(:project) } + let(:maintainer_project) { create(:project) } subject { described_class.new(user) } @@ -23,9 +23,9 @@ describe MoveToProjectFinder do it 'returns projects equal or above Gitlab::Access::REPORTER ordered by id in descending order' do reporter_project.add_reporter(user) developer_project.add_developer(user) - master_project.add_master(user) + maintainer_project.add_maintainer(user) - expect(subject.execute(project).to_a).to eq([master_project, developer_project, reporter_project]) + expect(subject.execute(project).to_a).to eq([maintainer_project, developer_project, reporter_project]) end it 'does not include the source project' do @@ -57,9 +57,9 @@ describe MoveToProjectFinder do reporter_project.add_reporter(user) developer_project.add_developer(user) - master_project.add_master(user) + maintainer_project.add_maintainer(user) - expect(subject.execute(project).to_a).to eq([master_project, developer_project]) + expect(subject.execute(project).to_a).to eq([maintainer_project, developer_project]) end it 'returns projects after the given offset id' do @@ -67,9 +67,9 @@ describe MoveToProjectFinder do reporter_project.add_reporter(user) developer_project.add_developer(user) - master_project.add_master(user) + maintainer_project.add_maintainer(user) - expect(subject.execute(project, search: nil, offset_id: master_project.id).to_a).to eq([developer_project, reporter_project]) + expect(subject.execute(project, search: nil, offset_id: maintainer_project.id).to_a).to eq([developer_project, reporter_project]) expect(subject.execute(project, search: nil, offset_id: developer_project.id).to_a).to eq([reporter_project]) expect(subject.execute(project, search: nil, offset_id: reporter_project.id).to_a).to be_empty end @@ -84,10 +84,10 @@ describe MoveToProjectFinder do it 'returns projects matching a search query' do foo_project = create(:project) - foo_project.add_master(user) + foo_project.add_maintainer(user) wadus_project = create(:project, name: 'wadus') - wadus_project.add_master(user) + wadus_project.add_maintainer(user) expect(subject.execute(project).to_a).to eq([wadus_project, foo_project]) expect(subject.execute(project, search: 'wadus').to_a).to eq([wadus_project]) diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb index 232f35c86f9..b776e9d856a 100644 --- a/spec/finders/notes_finder_spec.rb +++ b/spec/finders/notes_finder_spec.rb @@ -5,7 +5,7 @@ describe NotesFinder do let(:project) { create(:project) } before do - project.add_master(user) + project.add_maintainer(user) end describe '#execute' do diff --git a/spec/finders/projects_finder_spec.rb b/spec/finders/projects_finder_spec.rb index 0dfe6ba9c32..7931ad9b9f0 100644 --- a/spec/finders/projects_finder_spec.rb +++ b/spec/finders/projects_finder_spec.rb @@ -41,7 +41,7 @@ describe ProjectsFinder do describe 'with private projects' do before do - private_project.add_master(user) + private_project.add_maintainer(user) end it { is_expected.to match_array([public_project, internal_project, private_project]) } @@ -56,7 +56,7 @@ describe ProjectsFinder do describe 'filter by visibility_level' do before do - private_project.add_master(user) + private_project.add_maintainer(user) end context 'private' do diff --git a/spec/fixtures/trace/sample_trace b/spec/fixtures/trace/sample_trace index c65cf05d5ca..7bfe3f83b7b 100644 --- a/spec/fixtures/trace/sample_trace +++ b/spec/fixtures/trace/sample_trace @@ -41,7 +41,7 @@ From https://gitlab.com/gitlab-org/gitlab-ce section_end:1522927113:get_sources [0Ksection_start:1522927113:restore_cache [0K[32;1mChecking cache for ruby-2.3.6-with-yarn...[0;m -Downloading cache.zip from http://runners-cache-5-internal.gitlab.com:444/runner/project/13083/ruby-2.3.6-with-yarn[0;m +Downloading cache.zip from http://runners-cache-5-internal.gitlab.com:444/runner/project/13083/ruby-2.3.6-with-yarn[0;m [32;1mSuccessfully extracted cache[0;m section_end:1522927128:restore_cache [0Ksection_start:1522927128:download_artifacts @@ -51,7 +51,7 @@ Downloading artifacts from coordinator... ok [0;m id[0;m=61303215 respon Downloading artifacts from coordinator... ok [0;m id[0;m=61303216 responseStatus[0;m=200 OK token[0;m=iy2yYbq8 [32;1mDownloading artifacts for setup-test-env (61303217)...[0;m Downloading artifacts from coordinator... ok [0;m id[0;m=61303217 responseStatus[0;m=200 OK token[0;m=ur1g79-4 -[0;33mWARNING: tmp/tests/gitlab-shell/.gitlab_shell_secret: chmod tmp/tests/gitlab-shell/.gitlab_shell_secret: no such file or directory (suppressing repeats)[0;m +[0;33mWARNING: tmp/tests/gitlab-shell/.gitlab_shell_secret: chmod tmp/tests/gitlab-shell/.gitlab_shell_secret: no such file or directory (suppressing repeats)[0;m section_end:1522927141:download_artifacts [0Ksection_start:1522927141:build_script [0K[32;1m$ bundle --version[0;m @@ -1486,7 +1486,7 @@ Gitlab::ImportExport::ProjectTreeSaver overrides the project description group members does not export group members if it has no permission - does not export group members as master + does not export group members as maintainer exports group members as group owner as admin exports group members as admin @@ -1690,7 +1690,7 @@ GroupsController and logged in as Developer behaves like member without ability to create subgroups renders the 404 page (PENDING: around hook at ./spec/spec_helper.rb:186 did not execute the example) - and logged in as Master + and logged in as Maintainer behaves like member without ability to create subgroups renders the 404 page (PENDING: around hook at ./spec/spec_helper.rb:186 did not execute the example) and can_create_group is false @@ -1706,7 +1706,7 @@ GroupsController and logged in as Developer behaves like member without ability to create subgroups renders the 404 page (PENDING: around hook at ./spec/spec_helper.rb:186 did not execute the example) - and logged in as Master + and logged in as Maintainer behaves like member without ability to create subgroups renders the 404 page (PENDING: around hook at ./spec/spec_helper.rb:186 did not execute the example) GET #activity @@ -2324,7 +2324,7 @@ Editing file blob shows blob editor with same branch with protected branch shows blob editor with patch branch - as master + as maintainer shows blob editor with same branch Boards::Lists::MoveService @@ -2880,7 +2880,7 @@ API::V3::Environments won't update the external_url if only the name is passed returns a 404 if the environment does not exist DELETE /projects/:id/environments/:environment_id - as a master + as a maintainer returns a 200 for an existing environment returns a 404 for non existing id a non member @@ -3001,11 +3001,11 @@ LfsFileLock #can_be_unlocked_by? when it's forced can be unlocked by the author - can be unlocked by a master + can be unlocked by a maintainer can't be unlocked by other user when it isn't forced can be unlocked by the author - can't be unlocked by a master + can't be unlocked by a maintainer can't be unlocked by other user Gitlab::Ci::Config::Entry::Boolean @@ -3069,7 +3069,7 @@ Pending: (Failures listed here are expected and do not affect your suite's statu # around hook at ./spec/spec_helper.rb:186 did not execute the example # ./spec/controllers/groups_controller_spec.rb:25 - 5) GroupsController GET #new when creating subgroups and can_create_group is true and logged in as Master behaves like member without ability to create subgroups renders the 404 page + 5) GroupsController GET #new when creating subgroups and can_create_group is true and logged in as Maintainer behaves like member without ability to create subgroups renders the 404 page # around hook at ./spec/spec_helper.rb:186 did not execute the example # ./spec/controllers/groups_controller_spec.rb:25 @@ -3089,7 +3089,7 @@ Pending: (Failures listed here are expected and do not affect your suite's statu # around hook at ./spec/spec_helper.rb:186 did not execute the example # ./spec/controllers/groups_controller_spec.rb:25 - 10) GroupsController GET #new when creating subgroups and can_create_group is false and logged in as Master behaves like member without ability to create subgroups renders the 404 page + 10) GroupsController GET #new when creating subgroups and can_create_group is false and logged in as Maintainer behaves like member without ability to create subgroups renders the 404 page # around hook at ./spec/spec_helper.rb:186 did not execute the example # ./spec/controllers/groups_controller_spec.rb:25 @@ -3237,7 +3237,7 @@ Pending: (Failures listed here are expected and do not affect your suite's statu # around hook at ./spec/spec_helper.rb:190 did not execute the example # ./spec/services/groups/transfer_service_spec.rb:212 - 47) Groups::TransferService#execute when transferring a subgroup into another group when the group is allowed to be transferred should update parent group to the new parent + 47) Groups::TransferService#execute when transferring a subgroup into another group when the group is allowed to be transferred should update parent group to the new parent # around hook at ./spec/spec_helper.rb:190 did not execute the example # ./spec/services/groups/transfer_service_spec.rb:216 @@ -3435,10 +3435,10 @@ section_end:1522927515:after_script section_end:1522927516:archive_cache [0Ksection_start:1522927516:upload_artifacts [0K[32;1mUploading artifacts...[0;m -coverage/: found 5 matching files [0;m -knapsack/: found 5 matching files [0;m -rspec_flaky/: found 4 matching files [0;m -[0;33mWARNING: tmp/capybara/: no matching files [0;m +coverage/: found 5 matching files [0;m +knapsack/: found 5 matching files [0;m +rspec_flaky/: found 4 matching files [0;m +[0;33mWARNING: tmp/capybara/: no matching files [0;m Uploading artifacts to coordinator... ok [0;m id[0;m=61303283 responseStatus[0;m=201 Created token[0;m=rusBKvxM section_end:1522927520:upload_artifacts [0K[32;1mJob succeeded diff --git a/spec/helpers/markup_helper_spec.rb b/spec/helpers/markup_helper_spec.rb index d5ed5c59c61..597648b064d 100644 --- a/spec/helpers/markup_helper_spec.rb +++ b/spec/helpers/markup_helper_spec.rb @@ -11,7 +11,7 @@ describe MarkupHelper do before do # Ensure the generated reference links aren't redacted - project.add_master(user) + project.add_maintainer(user) # Helper expects a @project instance variable helper.instance_variable_set(:@project, project) diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb index b992bdb4a5e..21461e46cf4 100644 --- a/spec/helpers/notes_helper_spec.rb +++ b/spec/helpers/notes_helper_spec.rb @@ -6,18 +6,18 @@ describe NotesHelper do let(:owner) { create(:owner) } let(:group) { create(:group) } let(:project) { create(:project, namespace: group) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:reporter) { create(:user) } let(:guest) { create(:user) } let(:owner_note) { create(:note, author: owner, project: project) } - let(:master_note) { create(:note, author: master, project: project) } + let(:maintainer_note) { create(:note, author: maintainer, project: project) } let(:reporter_note) { create(:note, author: reporter, project: project) } - let!(:notes) { [owner_note, master_note, reporter_note] } + let!(:notes) { [owner_note, maintainer_note, reporter_note] } before do group.add_owner(owner) - project.add_master(master) + project.add_maintainer(maintainer) project.add_reporter(reporter) project.add_guest(guest) end @@ -25,16 +25,16 @@ describe NotesHelper do describe "#notes_max_access_for_users" do it 'returns access levels' do expect(helper.note_max_access_for_user(owner_note)).to eq(Gitlab::Access::OWNER) - expect(helper.note_max_access_for_user(master_note)).to eq(Gitlab::Access::MASTER) + expect(helper.note_max_access_for_user(maintainer_note)).to eq(Gitlab::Access::MAINTAINER) expect(helper.note_max_access_for_user(reporter_note)).to eq(Gitlab::Access::REPORTER) end it 'handles access in different projects' do second_project = create(:project) - second_project.add_reporter(master) - other_note = create(:note, author: master, project: second_project) + second_project.add_reporter(maintainer) + other_note = create(:note, author: maintainer, project: second_project) - expect(helper.note_max_access_for_user(master_note)).to eq(Gitlab::Access::MASTER) + expect(helper.note_max_access_for_user(maintainer_note)).to eq(Gitlab::Access::MAINTAINER) expect(helper.note_max_access_for_user(other_note)).to eq(Gitlab::Access::REPORTER) end end diff --git a/spec/helpers/time_helper_spec.rb b/spec/helpers/time_helper_spec.rb index 21f35585367..0b371d69ecf 100644 --- a/spec/helpers/time_helper_spec.rb +++ b/spec/helpers/time_helper_spec.rb @@ -4,10 +4,12 @@ describe TimeHelper do describe "#time_interval_in_words" do it "returns minutes and seconds" do intervals_in_words = { - 100 => "1 minute 40 seconds", - 100.32 => "1 minute 40 seconds", - 121 => "2 minutes 1 second", - 3721 => "62 minutes 1 second", + 60 => "1 minute", + 100 => "1 minute and 40 seconds", + 100.32 => "1 minute and 40 seconds", + 120 => "2 minutes", + 121 => "2 minutes and 1 second", + 3721 => "62 minutes and 1 second", 0 => "0 seconds" } diff --git a/spec/javascripts/diffs/components/changed_files_spec.js b/spec/javascripts/diffs/components/changed_files_spec.js index 2d57af6137c..f737e8fa38e 100644 --- a/spec/javascripts/diffs/components/changed_files_spec.js +++ b/spec/javascripts/diffs/components/changed_files_spec.js @@ -1,12 +1,17 @@ import Vue from 'vue'; -import $ from 'jquery'; +import Vuex from 'vuex'; import { mountComponentWithStore } from 'spec/helpers'; -import store from '~/diffs/store'; -import ChangedFiles from '~/diffs/components/changed_files.vue'; +import diffsModule from '~/diffs/store/modules'; +import changedFiles from '~/diffs/components/changed_files.vue'; describe('ChangedFiles', () => { - const Component = Vue.extend(ChangedFiles); - const createComponent = props => mountComponentWithStore(Component, { props, store }); + const Component = Vue.extend(changedFiles); + const store = new Vuex.Store({ + modules: { + diffs: diffsModule, + }, + }); + let vm; beforeEach(() => { @@ -14,6 +19,7 @@ describe('ChangedFiles', () => { <div id="dummy-element"></div> <div class="js-tabs-affix"></div> `); + const props = { diffFiles: [ { @@ -26,7 +32,8 @@ describe('ChangedFiles', () => { }, ], }; - vm = createComponent(props); + + vm = mountComponentWithStore(Component, { props, store }); }); describe('with single file added', () => { @@ -40,58 +47,56 @@ describe('ChangedFiles', () => { }); }); - describe('template', () => { - describe('diff view mode buttons', () => { - let inlineButton; - let parallelButton; + describe('diff view mode buttons', () => { + let inlineButton; + let parallelButton; - beforeEach(() => { - inlineButton = vm.$el.querySelector('.js-inline-diff-button'); - parallelButton = vm.$el.querySelector('.js-parallel-diff-button'); - }); + beforeEach(() => { + inlineButton = vm.$el.querySelector('.js-inline-diff-button'); + parallelButton = vm.$el.querySelector('.js-parallel-diff-button'); + }); + + it('should have Inline and Side-by-side buttons', () => { + expect(inlineButton).toBeDefined(); + expect(parallelButton).toBeDefined(); + }); + + it('should add active class to Inline button', done => { + vm.$store.state.diffs.diffViewType = 'inline'; + + vm.$nextTick(() => { + expect(inlineButton.classList.contains('active')).toEqual(true); + expect(parallelButton.classList.contains('active')).toEqual(false); - it('should have Inline and Side-by-side buttons', () => { - expect(inlineButton).toBeDefined(); - expect(parallelButton).toBeDefined(); + done(); }); + }); - it('should add active class to Inline button', done => { - vm.$store.state.diffs.diffViewType = 'inline'; + it('should toggle active state of buttons when diff view type changed', done => { + vm.$store.state.diffs.diffViewType = 'parallel'; - vm.$nextTick(() => { - expect(inlineButton.classList.contains('active')).toEqual(true); - expect(parallelButton.classList.contains('active')).toEqual(false); + vm.$nextTick(() => { + expect(inlineButton.classList.contains('active')).toEqual(false); + expect(parallelButton.classList.contains('active')).toEqual(true); - done(); - }); + done(); }); + }); - it('should toggle active state of buttons when diff view type changed', done => { - vm.$store.state.diffs.diffViewType = 'parallel'; + describe('clicking them', () => { + it('should toggle the diff view type', done => { + parallelButton.click(); vm.$nextTick(() => { expect(inlineButton.classList.contains('active')).toEqual(false); expect(parallelButton.classList.contains('active')).toEqual(true); - done(); - }); - }); - - describe('clicking them', () => { - it('should toggle the diff view type', done => { - $(parallelButton).click(); + inlineButton.click(); vm.$nextTick(() => { - expect(inlineButton.classList.contains('active')).toEqual(false); - expect(parallelButton.classList.contains('active')).toEqual(true); - - $(inlineButton).click(); - - vm.$nextTick(() => { - expect(inlineButton.classList.contains('active')).toEqual(true); - expect(parallelButton.classList.contains('active')).toEqual(false); - done(); - }); + expect(inlineButton.classList.contains('active')).toEqual(true); + expect(parallelButton.classList.contains('active')).toEqual(false); + done(); }); }); }); diff --git a/spec/javascripts/diffs/components/diff_file_header_spec.js b/spec/javascripts/diffs/components/diff_file_header_spec.js index 05f5d47ce42..0f3a95da5bf 100644 --- a/spec/javascripts/diffs/components/diff_file_header_spec.js +++ b/spec/javascripts/diffs/components/diff_file_header_spec.js @@ -1,7 +1,10 @@ import Vue from 'vue'; +import Vuex from 'vuex'; +import diffsModule from '~/diffs/store/modules'; +import notesModule from '~/notes/stores/modules'; import DiffFileHeader from '~/diffs/components/diff_file_header.vue'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; -import mountComponent from 'spec/helpers/vue_mount_component_helper'; +import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; const discussionFixture = 'merge_requests/diff_discussion.json'; @@ -9,6 +12,12 @@ describe('diff_file_header', () => { let vm; let props; const Component = Vue.extend(DiffFileHeader); + const store = new Vuex.Store({ + modules: { + diffs: diffsModule, + notes: notesModule, + }, + }); beforeEach(() => { const diffDiscussionMock = getJSONFixture(discussionFixture)[0]; @@ -26,13 +35,13 @@ describe('diff_file_header', () => { describe('computed', () => { describe('icon', () => { beforeEach(() => { - props.diffFile.blob.icon = 'dummy icon'; + props.diffFile.blob.icon = 'file-text-o'; }); it('returns the blob icon for files', () => { props.diffFile.submodule = false; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.icon).toBe(props.diffFile.blob.icon); }); @@ -40,7 +49,7 @@ describe('diff_file_header', () => { it('returns the archive icon for submodules', () => { props.diffFile.submodule = true; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.icon).toBe('archive'); }); @@ -58,7 +67,7 @@ describe('diff_file_header', () => { it('returns the fileHash for files', () => { props.diffFile.submodule = false; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.titleLink).toBe(`#${props.diffFile.fileHash}`); }); @@ -66,7 +75,7 @@ describe('diff_file_header', () => { it('returns the submoduleTreeUrl for submodules', () => { props.diffFile.submodule = true; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.titleLink).toBe(props.diffFile.submoduleTreeUrl); }); @@ -77,7 +86,7 @@ describe('diff_file_header', () => { submoduleTreeUrl: null, }); - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.titleLink).toBe(props.diffFile.submoduleLink); }); @@ -94,7 +103,7 @@ describe('diff_file_header', () => { it('returns the filePath for files', () => { props.diffFile.submodule = false; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.filePath).toBe(props.diffFile.filePath); }); @@ -102,7 +111,7 @@ describe('diff_file_header', () => { it('appends the truncated blob id for submodules', () => { props.diffFile.submodule = true; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.filePath).toBe( `${props.diffFile.filePath} @ ${props.diffFile.blob.id.substr(0, 8)}`, @@ -114,7 +123,7 @@ describe('diff_file_header', () => { it('returns a link tag if fileHash is set', () => { props.diffFile.fileHash = 'some hash'; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.titleTag).toBe('a'); }); @@ -122,7 +131,7 @@ describe('diff_file_header', () => { it('returns a span tag if fileHash is not set', () => { props.diffFile.fileHash = null; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.titleTag).toBe('span'); }); @@ -137,7 +146,7 @@ describe('diff_file_header', () => { }); it('returns true if file is stored in LFS', () => { - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.isUsingLfs).toBe(true); }); @@ -145,7 +154,7 @@ describe('diff_file_header', () => { it('returns false if file is not stored externally', () => { props.diffFile.storedExternally = false; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.isUsingLfs).toBe(false); }); @@ -153,7 +162,7 @@ describe('diff_file_header', () => { it('returns false if file is not stored in LFS', () => { props.diffFile.externalStorage = 'not lfs'; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.isUsingLfs).toBe(false); }); @@ -163,7 +172,7 @@ describe('diff_file_header', () => { it('returns chevron-down if the diff is expanded', () => { props.expanded = true; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.collapseIcon).toBe('chevron-down'); }); @@ -171,49 +180,18 @@ describe('diff_file_header', () => { it('returns chevron-right if the diff is collapsed', () => { props.expanded = false; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.collapseIcon).toBe('chevron-right'); }); }); - describe('isDiscussionsExpanded', () => { - beforeEach(() => { - Object.assign(props, { - discussionsExpanded: true, - expanded: true, - }); - }); - - it('returns true if diff and discussion are expanded', () => { - vm = mountComponent(Component, props); - - expect(vm.isDiscussionsExpanded).toBe(true); - }); - - it('returns false if discussion is collapsed', () => { - props.discussionsExpanded = false; - - vm = mountComponent(Component, props); - - expect(vm.isDiscussionsExpanded).toBe(false); - }); - - it('returns false if diff is collapsed', () => { - props.expanded = false; - - vm = mountComponent(Component, props); - - expect(vm.isDiscussionsExpanded).toBe(false); - }); - }); - describe('viewFileButtonText', () => { it('contains the truncated content SHA', () => { const dummySha = 'deebd00f is no SHA'; props.diffFile.contentSha = dummySha; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.viewFileButtonText).not.toContain(dummySha); expect(vm.viewFileButtonText).toContain(dummySha.substr(0, 8)); @@ -225,7 +203,7 @@ describe('diff_file_header', () => { const dummySha = 'deadabba sings no more'; props.diffFile.diffRefs.baseSha = dummySha; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.viewReplacedFileButtonText).not.toContain(dummySha); expect(vm.viewReplacedFileButtonText).toContain(dummySha.substr(0, 8)); @@ -234,25 +212,25 @@ describe('diff_file_header', () => { }); describe('methods', () => { - describe('handleToggle', () => { + describe('handleToggleFile', () => { beforeEach(() => { spyOn(vm, '$emit').and.stub(); }); it('emits toggleFile if checkTarget is false', () => { - vm.handleToggle(null, false); + vm.handleToggleFile(null, false); expect(vm.$emit).toHaveBeenCalledWith('toggleFile'); }); it('emits toggleFile if checkTarget is true and event target is header', () => { - vm.handleToggle({ target: vm.$refs.header }, true); + vm.handleToggleFile({ target: vm.$refs.header }, true); expect(vm.$emit).toHaveBeenCalledWith('toggleFile'); }); it('does not emit toggleFile if checkTarget is true and event target is not header', () => { - vm.handleToggle({ target: 'not header' }, true); + vm.handleToggleFile({ target: 'not header' }, true); expect(vm.$emit).not.toHaveBeenCalled(); }); @@ -266,7 +244,7 @@ describe('diff_file_header', () => { it('is visible if collapsible is true', () => { props.collapsible = true; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(collapseToggle()).not.toBe(null); }); @@ -274,14 +252,14 @@ describe('diff_file_header', () => { it('is hidden if collapsible is false', () => { props.collapsible = false; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(collapseToggle()).toBe(null); }); }); it('displays an file icon in the title', () => { - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.$el.querySelector('svg.js-file-icon use').getAttribute('xlink:href')).toContain( 'ruby', ); @@ -293,7 +271,7 @@ describe('diff_file_header', () => { it('displays the path of a added file', () => { props.diffFile.renamedFile = false; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(filePaths()).toHaveLength(1); expect(filePaths()[0]).toHaveText(props.diffFile.filePath); @@ -303,7 +281,7 @@ describe('diff_file_header', () => { props.diffFile.renamedFile = false; props.diffFile.deletedFile = true; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(filePaths()).toHaveLength(1); expect(filePaths()[0]).toHaveText(`${props.diffFile.filePath} deleted`); @@ -312,7 +290,7 @@ describe('diff_file_header', () => { it('displays old and new path if the file was renamed', () => { props.diffFile.renamedFile = true; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(filePaths()).toHaveLength(2); expect(filePaths()[0]).toHaveText(props.diffFile.oldPath); @@ -321,7 +299,7 @@ describe('diff_file_header', () => { }); it('displays a copy to clipboard button', () => { - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); const button = vm.$el.querySelector('.btn-clipboard'); expect(button).not.toBe(null); @@ -332,7 +310,7 @@ describe('diff_file_header', () => { it('it displays old and new file mode if it changed', () => { props.diffFile.modeChanged = true; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); const { fileMode } = vm.$refs; expect(fileMode).not.toBe(undefined); @@ -343,7 +321,7 @@ describe('diff_file_header', () => { it('does not display the file mode if it has not changed', () => { props.diffFile.modeChanged = false; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); const { fileMode } = vm.$refs; expect(fileMode).toBe(undefined); @@ -359,7 +337,7 @@ describe('diff_file_header', () => { externalStorage: 'lfs', }); - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(lfsLabel()).not.toBe(null); expect(lfsLabel()).toHaveText('LFS'); @@ -368,7 +346,7 @@ describe('diff_file_header', () => { it('does not display the LFS label for files stored in repository', () => { props.diffFile.storedExternally = false; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(lfsLabel()).toBe(null); }); @@ -376,7 +354,7 @@ describe('diff_file_header', () => { describe('edit button', () => { it('should not render edit button if addMergeRequestButtons is not true', () => { - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.$el.querySelector('.js-edit-blob')).toEqual(null); }); @@ -384,7 +362,7 @@ describe('diff_file_header', () => { it('should show edit button when file is editable', () => { props.addMergeRequestButtons = true; props.diffFile.editPath = '/'; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.$el.querySelector('.js-edit-blob')).toContainText('Edit'); }); @@ -393,7 +371,7 @@ describe('diff_file_header', () => { props.addMergeRequestButtons = true; props.diffFile.deletedFile = true; props.diffFile.editPath = '/'; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.$el.querySelector('.js-edit-blob')).toEqual(null); }); @@ -413,7 +391,7 @@ describe('diff_file_header', () => { props.diffFile.externalUrl = url; props.diffFile.formattedExternalUrl = title; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.$el.querySelector(`a[href="${url}"]`)).not.toBe(null); expect(vm.$el.querySelector(`a[data-original-title="View on ${title}"]`)).not.toBe(null); @@ -423,11 +401,39 @@ describe('diff_file_header', () => { props.diffFile.externalUrl = ''; props.diffFile.formattedExternalUrl = title; - vm = mountComponent(Component, props); + vm = mountComponentWithStore(Component, { props, store }); expect(vm.$el.querySelector(`a[data-original-title="View on ${title}"]`)).toBe(null); }); }); }); + + describe('handles toggle discussions', () => { + it('dispatches toggleFileDiscussions when user clicks on toggle discussions button', () => { + const propsCopy = Object.assign({}, props); + propsCopy.diffFile.submodule = false; + propsCopy.diffFile.blob = { + id: '848ed9407c6730ff16edb3dd24485a0eea24292a', + path: 'lib/base.js', + name: 'base.js', + mode: '100644', + readableText: true, + icon: 'file-text-o', + }; + propsCopy.addMergeRequestButtons = true; + propsCopy.diffFile.deletedFile = true; + + vm = mountComponentWithStore(Component, { + props: propsCopy, + store, + }); + + spyOn(vm, 'toggleFileDiscussions'); + + vm.$el.querySelector('.js-btn-vue-toggle-comments').click(); + + expect(vm.toggleFileDiscussions).toHaveBeenCalled(); + }); + }); }); }); diff --git a/spec/javascripts/diffs/store/actions_spec.js b/spec/javascripts/diffs/store/actions_spec.js index 6829c1e956a..c1560dac1a0 100644 --- a/spec/javascripts/diffs/store/actions_spec.js +++ b/spec/javascripts/diffs/store/actions_spec.js @@ -191,4 +191,48 @@ describe('DiffsStoreActions', () => { ); }); }); + + describe('toggleFileDiscussions', () => { + it('should dispatch collapseDiscussion when all discussions are expanded', () => { + const getters = { + getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ id: 1 }]), + diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(true), + diffHasAllCollpasedDiscussions: jasmine.createSpy().and.returnValue(false), + }; + + const dispatch = jasmine.createSpy('dispatch'); + + actions.toggleFileDiscussions({ getters, dispatch }); + + expect(dispatch).toHaveBeenCalledWith('collapseDiscussion', { discussionId: 1 }, { root: true }); + }); + + it('should dispatch expandDiscussion when all discussions are collapsed', () => { + const getters = { + getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ id: 1 }]), + diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(false), + diffHasAllCollpasedDiscussions: jasmine.createSpy().and.returnValue(true), + }; + + const dispatch = jasmine.createSpy(); + + actions.toggleFileDiscussions({ getters, dispatch }); + + expect(dispatch).toHaveBeenCalledWith('expandDiscussion', { discussionId: 1 }, { root: true }); + }); + + it('should dispatch expandDiscussion when some discussions are collapsed and others are expanded for the collapsed discussion', () => { + const getters = { + getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ expanded: false, id: 1 }]), + diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(false), + diffHasAllCollpasedDiscussions: jasmine.createSpy().and.returnValue(false), + }; + + const dispatch = jasmine.createSpy(); + + actions.toggleFileDiscussions({ getters, dispatch }); + + expect(dispatch).toHaveBeenCalledWith('expandDiscussion', { discussionId: 1 }, { root: true }); + }); + }); }); diff --git a/spec/javascripts/diffs/store/getters_spec.js b/spec/javascripts/diffs/store/getters_spec.js index 7a94f18778b..919b612bb6a 100644 --- a/spec/javascripts/diffs/store/getters_spec.js +++ b/spec/javascripts/diffs/store/getters_spec.js @@ -1,12 +1,24 @@ import * as getters from '~/diffs/store/getters'; import state from '~/diffs/store/modules/diff_state'; import { PARALLEL_DIFF_VIEW_TYPE, INLINE_DIFF_VIEW_TYPE } from '~/diffs/constants'; +import discussion from '../mock_data/diff_discussions'; -describe('DiffsStoreGetters', () => { +describe('Diffs Module Getters', () => { let localState; + let discussionMock; + let discussionMock1; + + const diffFileMock = { + fileHash: '9732849daca6ae818696d9575f5d1207d1a7f8bb', + }; beforeEach(() => { localState = state(); + discussionMock = Object.assign({}, discussion); + discussionMock.diff_file.file_hash = diffFileMock.fileHash; + + discussionMock1 = Object.assign({}, discussion); + discussionMock1.diff_file.file_hash = diffFileMock.fileHash; }); describe('isParallelView', () => { @@ -63,4 +75,113 @@ describe('DiffsStoreGetters', () => { expect(getters.commitId(localState)).toEqual(null); }); }); + + describe('diffHasAllExpandedDiscussions', () => { + it('returns true when all discussions are expanded', () => { + expect( + getters.diffHasAllExpandedDiscussions(localState, { + getDiffFileDiscussions: () => [discussionMock, discussionMock], + })(diffFileMock), + ).toEqual(true); + }); + + it('returns false when there are no discussions', () => { + expect( + getters.diffHasAllExpandedDiscussions(localState, { + getDiffFileDiscussions: () => [], + })(diffFileMock), + ).toEqual(false); + }); + + it('returns false when one discussions is collapsed', () => { + discussionMock1.expanded = false; + + expect( + getters.diffHasAllExpandedDiscussions(localState, { + getDiffFileDiscussions: () => [discussionMock, discussionMock1], + })(diffFileMock), + ).toEqual(false); + }); + }); + + describe('diffHasAllCollpasedDiscussions', () => { + it('returns true when all discussions are collapsed', () => { + discussionMock.diff_file.file_hash = diffFileMock.fileHash; + discussionMock.expanded = false; + + expect( + getters.diffHasAllCollpasedDiscussions(localState, { + getDiffFileDiscussions: () => [discussionMock], + })(diffFileMock), + ).toEqual(true); + }); + + it('returns false when there are no discussions', () => { + expect( + getters.diffHasAllCollpasedDiscussions(localState, { + getDiffFileDiscussions: () => [], + })(diffFileMock), + ).toEqual(false); + }); + + it('returns false when one discussions is expanded', () => { + discussionMock1.expanded = false; + + expect( + getters.diffHasAllCollpasedDiscussions(localState, { + getDiffFileDiscussions: () => [discussionMock, discussionMock1], + })(diffFileMock), + ).toEqual(false); + }); + }); + + describe('diffHasExpandedDiscussions', () => { + it('returns true when one of the discussions is expanded', () => { + discussionMock1.expanded = false; + + expect( + getters.diffHasExpandedDiscussions(localState, { + getDiffFileDiscussions: () => [discussionMock, discussionMock], + })(diffFileMock), + ).toEqual(true); + }); + + it('returns false when there are no discussions', () => { + expect( + getters.diffHasExpandedDiscussions(localState, { getDiffFileDiscussions: () => [] })( + diffFileMock, + ), + ).toEqual(false); + }); + + it('returns false when no discussion is expanded', () => { + discussionMock.expanded = false; + discussionMock1.expanded = false; + + expect( + getters.diffHasExpandedDiscussions(localState, { + getDiffFileDiscussions: () => [discussionMock, discussionMock1], + })(diffFileMock), + ).toEqual(false); + }); + }); + + describe('getDiffFileDiscussions', () => { + it('returns an array with discussions when fileHash matches and the discussion belongs to a diff', () => { + discussionMock.diff_file.file_hash = diffFileMock.fileHash; + + expect( + getters.getDiffFileDiscussions(localState, {}, {}, { discussions: [discussionMock] })( + diffFileMock, + ).length, + ).toEqual(1); + }); + + it('returns an empty array when no discussions are found in the given diff', () => { + expect( + getters.getDiffFileDiscussions(localState, {}, {}, { discussions: [] })(diffFileMock) + .length, + ).toEqual(0); + }); + }); }); diff --git a/spec/javascripts/environments/environment_rollback_spec.js b/spec/javascripts/environments/environment_rollback_spec.js index eb8e49d81fe..79f33c5bc8a 100644 --- a/spec/javascripts/environments/environment_rollback_spec.js +++ b/spec/javascripts/environments/environment_rollback_spec.js @@ -18,7 +18,7 @@ describe('Rollback Component', () => { }, }).$mount(); - expect(component.$el.querySelector('span').textContent).toContain('Re-deploy'); + expect(component.$el).toHaveSpriteIcon('repeat'); }); it('Should render Rollback label when isLastDeployment is false', () => { @@ -30,6 +30,6 @@ describe('Rollback Component', () => { }, }).$mount(); - expect(component.$el.querySelector('span').textContent).toContain('Rollback'); + expect(component.$el).toHaveSpriteIcon('redo'); }); }); diff --git a/spec/javascripts/environments/environment_stop_spec.js b/spec/javascripts/environments/environment_stop_spec.js index 3f95faf466a..4d9caa57566 100644 --- a/spec/javascripts/environments/environment_stop_spec.js +++ b/spec/javascripts/environments/environment_stop_spec.js @@ -4,7 +4,6 @@ import stopComp from '~/environments/components/environment_stop.vue'; describe('Stop Component', () => { let StopComponent; let component; - const stopURL = '/stop'; beforeEach(() => { StopComponent = Vue.extend(stopComp); @@ -12,20 +11,13 @@ describe('Stop Component', () => { component = new StopComponent({ propsData: { - stopUrl: stopURL, + environment: {}, }, }).$mount(); }); - describe('computed', () => { - it('title', () => { - expect(component.title).toEqual('Stop'); - }); - }); - it('should render a button to stop the environment', () => { expect(component.$el.tagName).toEqual('BUTTON'); - expect(component.$el.getAttribute('data-original-title')).toEqual('Stop'); - expect(component.$el.getAttribute('aria-label')).toEqual('Stop'); + expect(component.$el.getAttribute('data-original-title')).toEqual('Stop environment'); }); }); diff --git a/spec/javascripts/fixtures/commit.rb b/spec/javascripts/fixtures/commit.rb index 351db6ba184..24ab8159a18 100644 --- a/spec/javascripts/fixtures/commit.rb +++ b/spec/javascripts/fixtures/commit.rb @@ -14,7 +14,7 @@ describe Projects::CommitController, '(JavaScript fixtures)', type: :controller end before do - project.add_master(user) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/javascripts/fixtures/groups.rb b/spec/javascripts/fixtures/groups.rb index 35be52fbf97..a2035ceae15 100644 --- a/spec/javascripts/fixtures/groups.rb +++ b/spec/javascripts/fixtures/groups.rb @@ -13,7 +13,7 @@ describe 'Groups (JavaScript fixtures)', type: :controller do end before do - group.add_master(admin) + group.add_maintainer(admin) sign_in(admin) end diff --git a/spec/javascripts/fixtures/projects.rb b/spec/javascripts/fixtures/projects.rb index e8865b04874..57c78182abc 100644 --- a/spec/javascripts/fixtures/projects.rb +++ b/spec/javascripts/fixtures/projects.rb @@ -17,7 +17,7 @@ describe 'Projects (JavaScript fixtures)', type: :controller do end before do - project.add_master(admin) + project.add_maintainer(admin) sign_in(admin) end diff --git a/spec/javascripts/helpers/wait_for_promises.js b/spec/javascripts/helpers/wait_for_promises.js new file mode 100644 index 00000000000..1d2b53fc770 --- /dev/null +++ b/spec/javascripts/helpers/wait_for_promises.js @@ -0,0 +1 @@ +export default () => new Promise(resolve => requestAnimationFrame(resolve)); diff --git a/spec/javascripts/job_spec.js b/spec/javascripts/job_spec.js index 79e375aa02e..2fcb5566ebc 100644 --- a/spec/javascripts/job_spec.js +++ b/spec/javascripts/job_spec.js @@ -5,6 +5,7 @@ import { numberToHumanSize } from '~/lib/utils/number_utils'; import '~/lib/utils/datetime_utility'; import Job from '~/job'; import '~/breakpoints'; +import waitForPromises from 'spec/helpers/wait_for_promises'; describe('Job', () => { const JOB_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/-/jobs/1`; @@ -12,10 +13,6 @@ describe('Job', () => { let response; let job; - function waitForPromise() { - return new Promise(resolve => requestAnimationFrame(resolve)); - } - preloadFixtures('builds/build-with-artifacts.html.raw'); beforeEach(() => { @@ -49,7 +46,7 @@ describe('Job', () => { beforeEach(function (done) { job = new Job(); - waitForPromise() + waitForPromises() .then(done) .catch(done.fail); }); @@ -93,7 +90,7 @@ describe('Job', () => { job = new Job(); - waitForPromise() + waitForPromises() .then(() => { expect($('#build-trace .js-build-output').text()).toMatch(/Update/); expect(job.state).toBe('newstate'); @@ -107,7 +104,7 @@ describe('Job', () => { }; }) .then(() => jasmine.clock().tick(4001)) - .then(waitForPromise) + .then(waitForPromises) .then(() => { expect($('#build-trace .js-build-output').text()).toMatch(/UpdateMore/); expect(job.state).toBe('finalstate'); @@ -126,7 +123,7 @@ describe('Job', () => { job = new Job(); - waitForPromise() + waitForPromises() .then(() => { expect($('#build-trace .js-build-output').text()).toMatch(/Update/); @@ -137,7 +134,7 @@ describe('Job', () => { }; }) .then(() => jasmine.clock().tick(4001)) - .then(waitForPromise) + .then(waitForPromises) .then(() => { expect($('#build-trace .js-build-output').text()).not.toMatch(/Update/); expect($('#build-trace .js-build-output').text()).toMatch(/Different/); @@ -160,7 +157,7 @@ describe('Job', () => { job = new Job(); - waitForPromise() + waitForPromises() .then(() => { expect(document.querySelector('.js-truncated-info').classList).not.toContain('hidden'); }) @@ -181,7 +178,7 @@ describe('Job', () => { job = new Job(); - waitForPromise() + waitForPromises() .then(() => { expect( document.querySelector('.js-truncated-info-size').textContent.trim(), @@ -203,7 +200,7 @@ describe('Job', () => { job = new Job(); - waitForPromise() + waitForPromises() .then(() => { expect( document.querySelector('.js-truncated-info-size').textContent.trim(), @@ -219,7 +216,7 @@ describe('Job', () => { }; }) .then(() => jasmine.clock().tick(4001)) - .then(waitForPromise) + .then(waitForPromises) .then(() => { expect( document.querySelector('.js-truncated-info-size').textContent.trim(), @@ -258,7 +255,7 @@ describe('Job', () => { job = new Job(); - waitForPromise() + waitForPromises() .then(() => { expect(document.querySelector('.js-truncated-info').classList).toContain('hidden'); }) @@ -280,7 +277,7 @@ describe('Job', () => { job = new Job(); - waitForPromise() + waitForPromises() .then(done) .catch(done.fail); }); diff --git a/spec/javascripts/notes/stores/actions_spec.js b/spec/javascripts/notes/stores/actions_spec.js index 71ef3aa9b03..b66e8e1ceb3 100644 --- a/spec/javascripts/notes/stores/actions_spec.js +++ b/spec/javascripts/notes/stores/actions_spec.js @@ -128,6 +128,19 @@ describe('Actions Notes Store', () => { }); }); + describe('collapseDiscussion', () => { + it('should commit collapse discussion', done => { + testAction( + actions.collapseDiscussion, + { discussionId: discussionMock.id }, + { notes: [discussionMock] }, + [{ type: 'COLLAPSE_DISCUSSION', payload: { discussionId: discussionMock.id } }], + [], + done, + ); + }); + }); + describe('async methods', () => { const interceptor = (request, next) => { next( diff --git a/spec/javascripts/notes/stores/mutation_spec.js b/spec/javascripts/notes/stores/mutation_spec.js index ccc7328447b..a15ff1a5888 100644 --- a/spec/javascripts/notes/stores/mutation_spec.js +++ b/spec/javascripts/notes/stores/mutation_spec.js @@ -74,6 +74,20 @@ describe('Notes Store mutations', () => { }); }); + describe('COLLAPSE_DISCUSSION', () => { + it('should collpase an expanded discussion', () => { + const discussion = Object.assign({}, discussionMock, { expanded: true }); + + const state = { + discussions: [discussion], + }; + + mutations.COLLAPSE_DISCUSSION(state, { discussionId: discussion.id }); + + expect(state.discussions[0].expanded).toEqual(false); + }); + }); + describe('REMOVE_PLACEHOLDER_NOTES', () => { it('should remove all placeholder notes in indivudal notes and discussion', () => { const placeholderNote = Object.assign({}, individualNote, { isPlaceholderNote: true }); diff --git a/spec/javascripts/smart_interval_spec.js b/spec/javascripts/smart_interval_spec.js index 60153672214..d9b6dd1d487 100644 --- a/spec/javascripts/smart_interval_spec.js +++ b/spec/javascripts/smart_interval_spec.js @@ -1,12 +1,12 @@ import $ from 'jquery'; import _ from 'underscore'; import SmartInterval from '~/smart_interval'; +import waitForPromises from 'spec/helpers/wait_for_promises'; describe('SmartInterval', function () { const DEFAULT_MAX_INTERVAL = 100; const DEFAULT_STARTING_INTERVAL = 5; const DEFAULT_SHORT_TIMEOUT = 75; - const DEFAULT_LONG_TIMEOUT = 1000; const DEFAULT_INCREMENT_FACTOR = 2; function createDefaultSmartInterval(config) { @@ -27,52 +27,65 @@ describe('SmartInterval', function () { return new SmartInterval(defaultParams); } + beforeEach(() => { + jasmine.clock().install(); + }); + + afterEach(() => { + jasmine.clock().uninstall(); + }); + describe('Increment Interval', function () { - beforeEach(function () { - this.smartInterval = createDefaultSmartInterval(); - }); + it('should increment the interval delay', (done) => { + const smartInterval = createDefaultSmartInterval(); - it('should increment the interval delay', function (done) { - const interval = this.smartInterval; - setTimeout(() => { - const intervalConfig = this.smartInterval.cfg; - const iterationCount = 4; - const maxIntervalAfterIterations = intervalConfig.startingInterval * - (intervalConfig.incrementByFactorOf ** (iterationCount - 1)); // 40 - const currentInterval = interval.getCurrentInterval(); - - // Provide some flexibility for performance of testing environment - expect(currentInterval).toBeGreaterThan(intervalConfig.startingInterval); - expect(currentInterval <= maxIntervalAfterIterations).toBeTruthy(); - - done(); - }, DEFAULT_SHORT_TIMEOUT); // 4 iterations, increment by 2x = (5 + 10 + 20 + 40) + jasmine.clock().tick(DEFAULT_SHORT_TIMEOUT); + + waitForPromises() + .then(() => { + const intervalConfig = smartInterval.cfg; + const iterationCount = 4; + const maxIntervalAfterIterations = intervalConfig.startingInterval * + (intervalConfig.incrementByFactorOf ** iterationCount); + const currentInterval = smartInterval.getCurrentInterval(); + + // Provide some flexibility for performance of testing environment + expect(currentInterval).toBeGreaterThan(intervalConfig.startingInterval); + expect(currentInterval).toBeLessThanOrEqual(maxIntervalAfterIterations); + }) + .then(done) + .catch(done.fail); }); - it('should not increment past maxInterval', function (done) { - const interval = this.smartInterval; + it('should not increment past maxInterval', (done) => { + const smartInterval = createDefaultSmartInterval({ maxInterval: DEFAULT_STARTING_INTERVAL }); - setTimeout(() => { - const currentInterval = interval.getCurrentInterval(); - expect(currentInterval).toBe(interval.cfg.maxInterval); + jasmine.clock().tick(DEFAULT_STARTING_INTERVAL); + jasmine.clock().tick(DEFAULT_STARTING_INTERVAL * DEFAULT_INCREMENT_FACTOR); - done(); - }, DEFAULT_LONG_TIMEOUT); + waitForPromises() + .then(() => { + const currentInterval = smartInterval.getCurrentInterval(); + expect(currentInterval).toBe(smartInterval.cfg.maxInterval); + }) + .then(done) + .catch(done.fail); }); - it('does not increment while waiting for callback', function () { - jasmine.clock().install(); - + it('does not increment while waiting for callback', done => { const smartInterval = createDefaultSmartInterval({ callback: () => new Promise($.noop), }); jasmine.clock().tick(DEFAULT_SHORT_TIMEOUT); - const oneInterval = smartInterval.cfg.startingInterval * DEFAULT_INCREMENT_FACTOR; - expect(smartInterval.getCurrentInterval()).toEqual(oneInterval); - - jasmine.clock().uninstall(); + waitForPromises() + .then(() => { + const oneInterval = smartInterval.cfg.startingInterval * DEFAULT_INCREMENT_FACTOR; + expect(smartInterval.getCurrentInterval()).toEqual(oneInterval); + }) + .then(done) + .catch(done.fail); }); }); @@ -84,34 +97,39 @@ describe('SmartInterval', function () { it('should cancel an interval', function (done) { const interval = this.smartInterval; - setTimeout(() => { - interval.cancel(); + jasmine.clock().tick(DEFAULT_SHORT_TIMEOUT); - const { intervalId } = interval.state; - const currentInterval = interval.getCurrentInterval(); - const intervalLowerLimit = interval.cfg.startingInterval; + interval.cancel(); - expect(intervalId).toBeUndefined(); - expect(currentInterval).toBe(intervalLowerLimit); + waitForPromises() + .then(() => { + const { intervalId } = interval.state; + const currentInterval = interval.getCurrentInterval(); + const intervalLowerLimit = interval.cfg.startingInterval; - done(); - }, DEFAULT_SHORT_TIMEOUT); + expect(intervalId).toBeUndefined(); + expect(currentInterval).toBe(intervalLowerLimit); + }) + .then(done) + .catch(done.fail); }); it('should resume an interval', function (done) { const interval = this.smartInterval; - setTimeout(() => { - interval.cancel(); - - interval.resume(); + jasmine.clock().tick(DEFAULT_SHORT_TIMEOUT); - const { intervalId } = interval.state; + interval.cancel(); - expect(intervalId).toBeTruthy(); + interval.resume(); - done(); - }, DEFAULT_SHORT_TIMEOUT); + waitForPromises() + .then(() => { + const { intervalId } = interval.state; + expect(intervalId).toBeTruthy(); + }) + .then(done) + .catch(done.fail); }); }); @@ -126,64 +144,79 @@ describe('SmartInterval', function () { it('should pause when page is not visible', function (done) { const interval = this.smartInterval; - setTimeout(() => { - expect(interval.state.intervalId).toBeTruthy(); + jasmine.clock().tick(DEFAULT_SHORT_TIMEOUT); + + waitForPromises() + .then(() => { + expect(interval.state.intervalId).toBeTruthy(); - // simulates triggering of visibilitychange event - interval.handleVisibilityChange({ target: { visibilityState: 'hidden' } }); + // simulates triggering of visibilitychange event + interval.handleVisibilityChange({ target: { visibilityState: 'hidden' } }); - expect(interval.state.intervalId).toBeUndefined(); - done(); - }, DEFAULT_SHORT_TIMEOUT); + expect(interval.state.intervalId).toBeUndefined(); + }) + .then(done) + .catch(done.fail); }); - it('should change to the hidden interval when page is not visible', function (done) { + it('should change to the hidden interval when page is not visible', done => { const HIDDEN_INTERVAL = 1500; const interval = createDefaultSmartInterval({ hiddenInterval: HIDDEN_INTERVAL }); - setTimeout(() => { - expect(interval.state.intervalId).toBeTruthy(); - expect(interval.getCurrentInterval() >= DEFAULT_STARTING_INTERVAL && - interval.getCurrentInterval() <= DEFAULT_MAX_INTERVAL).toBeTruthy(); + jasmine.clock().tick(DEFAULT_SHORT_TIMEOUT); + + waitForPromises() + .then(() => { + expect(interval.state.intervalId).toBeTruthy(); + expect(interval.getCurrentInterval() >= DEFAULT_STARTING_INTERVAL && + interval.getCurrentInterval() <= DEFAULT_MAX_INTERVAL).toBeTruthy(); - // simulates triggering of visibilitychange event - interval.handleVisibilityChange({ target: { visibilityState: 'hidden' } }); + // simulates triggering of visibilitychange event + interval.handleVisibilityChange({ target: { visibilityState: 'hidden' } }); - expect(interval.state.intervalId).toBeTruthy(); - expect(interval.getCurrentInterval()).toBe(HIDDEN_INTERVAL); - done(); - }, DEFAULT_SHORT_TIMEOUT); + expect(interval.state.intervalId).toBeTruthy(); + expect(interval.getCurrentInterval()).toBe(HIDDEN_INTERVAL); + }) + .then(done) + .catch(done.fail); }); it('should resume when page is becomes visible at the previous interval', function (done) { const interval = this.smartInterval; - setTimeout(() => { - expect(interval.state.intervalId).toBeTruthy(); + jasmine.clock().tick(DEFAULT_SHORT_TIMEOUT); - // simulates triggering of visibilitychange event - interval.handleVisibilityChange({ target: { visibilityState: 'hidden' } }); + waitForPromises() + .then(() => { + expect(interval.state.intervalId).toBeTruthy(); - expect(interval.state.intervalId).toBeUndefined(); + // simulates triggering of visibilitychange event + interval.handleVisibilityChange({ target: { visibilityState: 'hidden' } }); - // simulates triggering of visibilitychange event - interval.handleVisibilityChange({ target: { visibilityState: 'visible' } }); + expect(interval.state.intervalId).toBeUndefined(); - expect(interval.state.intervalId).toBeTruthy(); + // simulates triggering of visibilitychange event + interval.handleVisibilityChange({ target: { visibilityState: 'visible' } }); - done(); - }, DEFAULT_SHORT_TIMEOUT); + expect(interval.state.intervalId).toBeTruthy(); + }) + .then(done) + .catch(done.fail); }); it('should cancel on page unload', function (done) { const interval = this.smartInterval; - setTimeout(() => { - $(document).triggerHandler('beforeunload'); - expect(interval.state.intervalId).toBeUndefined(); - expect(interval.getCurrentInterval()).toBe(interval.cfg.startingInterval); - done(); - }, DEFAULT_SHORT_TIMEOUT); + jasmine.clock().tick(DEFAULT_SHORT_TIMEOUT); + + waitForPromises() + .then(() => { + $(document).triggerHandler('beforeunload'); + expect(interval.state.intervalId).toBeUndefined(); + expect(interval.getCurrentInterval()).toBe(interval.cfg.startingInterval); + }) + .then(done) + .catch(done.fail); }); it('should execute callback before first interval', function () { diff --git a/spec/lib/banzai/filter/redactor_filter_spec.rb b/spec/lib/banzai/filter/redactor_filter_spec.rb index 9a2e521fdcf..919825a6102 100644 --- a/spec/lib/banzai/filter/redactor_filter_spec.rb +++ b/spec/lib/banzai/filter/redactor_filter_spec.rb @@ -46,7 +46,7 @@ describe Banzai::Filter::RedactorFilter do it 'allows permitted Project references' do user = create(:user) project = create(:project) - project.add_master(user) + project.add_maintainer(user) link = reference_link(project: project.id, reference_type: 'test') doc = filter(link, current_user: user) diff --git a/spec/lib/gitlab/background_migration/delete_diff_files_spec.rb b/spec/lib/gitlab/background_migration/delete_diff_files_spec.rb index 1b3df7b20d4..64c994a268f 100644 --- a/spec/lib/gitlab/background_migration/delete_diff_files_spec.rb +++ b/spec/lib/gitlab/background_migration/delete_diff_files_spec.rb @@ -1,31 +1,35 @@ require 'spec_helper' -describe Gitlab::BackgroundMigration::DeleteDiffFiles, :migration, schema: 20180626125654 do +describe Gitlab::BackgroundMigration::DeleteDiffFiles, :migration, schema: 20180619121030 do describe '#perform' do context 'when diff files can be deleted' do let(:merge_request) { create(:merge_request, :merged) } - let(:merge_request_diff) do + let!(:merge_request_diff) do merge_request.create_merge_request_diff merge_request.merge_request_diffs.first end + let(:perform) do + described_class.new.perform(MergeRequestDiff.pluck(:id)) + end + it 'deletes all merge request diff files' do - expect { described_class.new.perform(merge_request_diff.id) } + expect { perform } .to change { merge_request_diff.merge_request_diff_files.count } .from(20).to(0) end it 'updates state to without_files' do - expect { described_class.new.perform(merge_request_diff.id) } + expect { perform } .to change { merge_request_diff.reload.state } .from('collected').to('without_files') end it 'rollsback if something goes wrong' do - expect(MergeRequestDiffFile).to receive_message_chain(:where, :delete_all) + expect(described_class::MergeRequestDiffFile).to receive_message_chain(:where, :delete_all) .and_raise - expect { described_class.new.perform(merge_request_diff.id) } + expect { perform } .to raise_error merge_request_diff.reload @@ -35,35 +39,35 @@ describe Gitlab::BackgroundMigration::DeleteDiffFiles, :migration, schema: 20180 end end - it 'deletes no merge request diff files when MR is not merged' do - merge_request = create(:merge_request, :opened) - merge_request.create_merge_request_diff - merge_request_diff = merge_request.merge_request_diffs.first - - expect { described_class.new.perform(merge_request_diff.id) } - .not_to change { merge_request_diff.merge_request_diff_files.count } - .from(20) - end - - it 'deletes no merge request diff files when diff is marked as "without_files"' do + it 'reschedules itself when should_wait_deadtuple_vacuum' do merge_request = create(:merge_request, :merged) - merge_request.create_merge_request_diff - merge_request_diff = merge_request.merge_request_diffs.first + first_diff = merge_request.merge_request_diff + second_diff = merge_request.create_merge_request_diff - merge_request_diff.clean! + Sidekiq::Testing.fake! do + worker = described_class.new + allow(worker).to receive(:should_wait_deadtuple_vacuum?) { true } - expect { described_class.new.perform(merge_request_diff.id) } - .not_to change { merge_request_diff.merge_request_diff_files.count } - .from(20) + worker.perform([first_diff.id, second_diff.id]) + + expect(described_class.name.demodulize).to be_scheduled_delayed_migration(5.minutes, [first_diff.id, second_diff.id]) + expect(BackgroundMigrationWorker.jobs.size).to eq(1) + end end + end - it 'deletes no merge request diff files when diff is the latest' do - merge_request = create(:merge_request, :merged) - merge_request_diff = merge_request.merge_request_diff + describe '#should_wait_deadtuple_vacuum?' do + it 'returns true when hitting merge_request_diff_files hits DEAD_TUPLES_THRESHOLD', :postgresql do + worker = described_class.new + threshold_query_result = [{ "n_dead_tup" => described_class::DEAD_TUPLES_THRESHOLD.to_s }] + normal_query_result = [{ "n_dead_tup" => '3' }] + + allow(worker) + .to receive(:execute_statement) + .with(/SELECT n_dead_tup */) + .and_return(threshold_query_result, normal_query_result) - expect { described_class.new.perform(merge_request_diff.id) } - .not_to change { merge_request_diff.merge_request_diff_files.count } - .from(20) + expect(worker.should_wait_deadtuple_vacuum?).to be(true) end end end diff --git a/spec/lib/gitlab/background_migration/schedule_diff_files_deletion_spec.rb b/spec/lib/gitlab/background_migration/schedule_diff_files_deletion_spec.rb new file mode 100644 index 00000000000..fb5093b0bd1 --- /dev/null +++ b/spec/lib/gitlab/background_migration/schedule_diff_files_deletion_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +describe Gitlab::BackgroundMigration::ScheduleDiffFilesDeletion, :migration, schema: 20180619121030 do + describe '#perform' do + let(:merge_request_diffs) { table(:merge_request_diffs) } + let(:merge_requests) { table(:merge_requests) } + let(:namespaces) { table(:namespaces) } + let(:projects) { table(:projects) } + + before do + stub_const("#{described_class.name}::DIFF_BATCH_SIZE", 3) + + namespaces.create!(id: 1, name: 'gitlab', path: 'gitlab') + projects.create!(id: 1, namespace_id: 1, name: 'gitlab', path: 'gitlab') + + merge_requests.create!(id: 1, target_project_id: 1, source_project_id: 1, target_branch: 'feature', source_branch: 'master', state: 'merged') + + merge_request_diffs.create!(id: 1, merge_request_id: 1, state: 'collected') + merge_request_diffs.create!(id: 2, merge_request_id: 1, state: 'empty') + merge_request_diffs.create!(id: 3, merge_request_id: 1, state: 'without_files') + merge_request_diffs.create!(id: 4, merge_request_id: 1, state: 'collected') + merge_request_diffs.create!(id: 5, merge_request_id: 1, state: 'collected') + merge_request_diffs.create!(id: 6, merge_request_id: 1, state: 'collected') + merge_request_diffs.create!(id: 7, merge_request_id: 1, state: 'collected') + + merge_requests.update(1, latest_merge_request_diff_id: 7) + end + + it 'correctly schedules diff file deletion workers' do + Sidekiq::Testing.fake! do + Timecop.freeze do + described_class.new.perform + + expect(described_class::MIGRATION).to be_scheduled_delayed_migration(5.minutes, [1, 4, 5]) + + expect(described_class::MIGRATION).to be_scheduled_delayed_migration(10.minutes, [6]) + + expect(BackgroundMigrationWorker.jobs.size).to eq(2) + end + end + end + end +end diff --git a/spec/lib/gitlab/checks/change_access_spec.rb b/spec/lib/gitlab/checks/change_access_spec.rb index 1cb8143a9e9..7c04aa27971 100644 --- a/spec/lib/gitlab/checks/change_access_spec.rb +++ b/spec/lib/gitlab/checks/change_access_spec.rb @@ -54,7 +54,7 @@ describe Gitlab::Checks::ChangeAccess do context 'as maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end context 'deletion' do @@ -144,7 +144,7 @@ describe Gitlab::Checks::ChangeAccess do context 'if the user is allowed to delete protected branches' do before do - project.add_master(user) + project.add_maintainer(user) end context 'through the web interface' do diff --git a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb index 6a52ae01b2f..e327399d82d 100644 --- a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb +++ b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb @@ -2,13 +2,21 @@ require 'spec_helper' describe Gitlab::Ci::Build::Artifacts::Metadata do def metadata(path = '', **opts) - described_class.new(metadata_file_path, path, **opts) + described_class.new(metadata_file_stream, path, **opts) end let(:metadata_file_path) do Rails.root + 'spec/fixtures/ci_build_artifacts_metadata.gz' end + let(:metadata_file_stream) do + File.open(metadata_file_path) if metadata_file_path + end + + after do + metadata_file_stream&.close + end + context 'metadata file exists' do describe '#find_entries! empty string' do subject { metadata('').find_entries! } @@ -86,11 +94,21 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do end context 'metadata file does not exist' do - let(:metadata_file_path) { '' } + let(:metadata_file_path) { nil } + + describe '#find_entries!' do + it 'raises error' do + expect { metadata.find_entries! }.to raise_error(described_class::InvalidStreamError, /Invalid stream/) + end + end + end + + context 'metadata file is invalid' do + let(:metadata_file_path) { Rails.root + 'spec/fixtures/ci_build_artifacts.zip' } describe '#find_entries!' do it 'raises error' do - expect { metadata.find_entries! }.to raise_error(Errno::ENOENT) + expect { metadata.find_entries! }.to raise_error(described_class::InvalidStreamError, /not in gzip format/) end end end diff --git a/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb index a973ccda8de..8ba56d73838 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb @@ -99,9 +99,9 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::Abilities do end end - context 'when user is a master' do + context 'when user is a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it { is_expected.to be_truthy } diff --git a/spec/lib/gitlab/ci/status/build/play_spec.rb b/spec/lib/gitlab/ci/status/build/play_spec.rb index e2bb378f663..02f8c4c114b 100644 --- a/spec/lib/gitlab/ci/status/build/play_spec.rb +++ b/spec/lib/gitlab/ci/status/build/play_spec.rb @@ -46,7 +46,7 @@ describe Gitlab::Ci::Status::Build::Play do context 'when user can not push to the branch' do before do build.project.add_developer(user) - create(:protected_branch, :masters_can_push, + create(:protected_branch, :maintainers_can_push, name: build.ref, project: project) end diff --git a/spec/lib/gitlab/ci/status/stage/common_spec.rb b/spec/lib/gitlab/ci/status/stage/common_spec.rb index 6ec35f8da7e..bb2d0a2c75c 100644 --- a/spec/lib/gitlab/ci/status/stage/common_spec.rb +++ b/spec/lib/gitlab/ci/status/stage/common_spec.rb @@ -27,7 +27,7 @@ describe Gitlab::Ci::Status::Stage::Common do context 'when user has permission to read pipeline' do before do - project.add_master(user) + project.add_maintainer(user) end it 'has details' do diff --git a/spec/lib/gitlab/closing_issue_extractor_spec.rb b/spec/lib/gitlab/closing_issue_extractor_spec.rb index 8d4862932b2..3a0688b7cbb 100644 --- a/spec/lib/gitlab/closing_issue_extractor_spec.rb +++ b/spec/lib/gitlab/closing_issue_extractor_spec.rb @@ -15,7 +15,7 @@ describe Gitlab::ClosingIssueExtractor do before do project.add_developer(project.creator) project.add_developer(project2.creator) - project2.add_master(project.creator) + project2.add_maintainer(project.creator) end describe "#closed_by_message" do @@ -298,7 +298,7 @@ describe Gitlab::ClosingIssueExtractor do context 'with an external issue tracker reference' do it 'extracts the referenced issue' do jira_project = create(:jira_project, name: 'JIRA_EXT1') - jira_project.add_master(jira_project.creator) + jira_project.add_maintainer(jira_project.creator) jira_issue = ExternalIssue.new("#{jira_project.name}-1", project: jira_project) closing_issue_extractor = described_class.new(jira_project, jira_project.creator) message = "Resolve #{jira_issue.to_reference}" diff --git a/spec/lib/gitlab/cycle_analytics/permissions_spec.rb b/spec/lib/gitlab/cycle_analytics/permissions_spec.rb index 6de4bd3dc7c..f670c7f6c75 100644 --- a/spec/lib/gitlab/cycle_analytics/permissions_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/permissions_spec.rb @@ -36,9 +36,9 @@ describe Gitlab::CycleAnalytics::Permissions do end end - context 'user is master' do + context 'user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it 'has permissions to issue stage' do diff --git a/spec/lib/gitlab/git/blob_spec.rb b/spec/lib/gitlab/git/blob_spec.rb index 6900c4189b7..034b89a46fa 100644 --- a/spec/lib/gitlab/git/blob_spec.rb +++ b/spec/lib/gitlab/git/blob_spec.rb @@ -178,77 +178,67 @@ describe Gitlab::Git::Blob, seed_helper: true do end describe '.batch' do - shared_examples 'loading blobs in batch' do - let(:blob_references) do - [ - [SeedRepo::Commit::ID, "files/ruby/popen.rb"], - [SeedRepo::Commit::ID, 'six'] - ] - end + let(:blob_references) do + [ + [SeedRepo::Commit::ID, "files/ruby/popen.rb"], + [SeedRepo::Commit::ID, 'six'] + ] + end - subject { described_class.batch(repository, blob_references) } + subject { described_class.batch(repository, blob_references) } - it { expect(subject.size).to eq(blob_references.size) } + it { expect(subject.size).to eq(blob_references.size) } - context 'first blob' do - let(:blob) { subject[0] } + context 'first blob' do + let(:blob) { subject[0] } - it { expect(blob.id).to eq(SeedRepo::RubyBlob::ID) } - it { expect(blob.name).to eq(SeedRepo::RubyBlob::NAME) } - it { expect(blob.path).to eq("files/ruby/popen.rb") } - it { expect(blob.commit_id).to eq(SeedRepo::Commit::ID) } - it { expect(blob.data[0..10]).to eq(SeedRepo::RubyBlob::CONTENT[0..10]) } - it { expect(blob.size).to eq(669) } - it { expect(blob.mode).to eq("100644") } - end + it { expect(blob.id).to eq(SeedRepo::RubyBlob::ID) } + it { expect(blob.name).to eq(SeedRepo::RubyBlob::NAME) } + it { expect(blob.path).to eq("files/ruby/popen.rb") } + it { expect(blob.commit_id).to eq(SeedRepo::Commit::ID) } + it { expect(blob.data[0..10]).to eq(SeedRepo::RubyBlob::CONTENT[0..10]) } + it { expect(blob.size).to eq(669) } + it { expect(blob.mode).to eq("100644") } + end - context 'second blob' do - let(:blob) { subject[1] } + context 'second blob' do + let(:blob) { subject[1] } - it { expect(blob.id).to eq('409f37c4f05865e4fb208c771485f211a22c4c2d') } - it { expect(blob.data).to eq('') } - it 'does not mark the blob as binary' do - expect(blob).not_to be_binary - end + it { expect(blob.id).to eq('409f37c4f05865e4fb208c771485f211a22c4c2d') } + it { expect(blob.data).to eq('') } + it 'does not mark the blob as binary' do + expect(blob).not_to be_binary end + end - context 'limiting' do - subject { described_class.batch(repository, blob_references, blob_size_limit: blob_size_limit) } + context 'limiting' do + subject { described_class.batch(repository, blob_references, blob_size_limit: blob_size_limit) } - context 'positive' do - let(:blob_size_limit) { 10 } + context 'positive' do + let(:blob_size_limit) { 10 } - it { expect(subject.first.data.size).to eq(10) } - end + it { expect(subject.first.data.size).to eq(10) } + end - context 'zero' do - let(:blob_size_limit) { 0 } + context 'zero' do + let(:blob_size_limit) { 0 } - it 'only loads the metadata' do - expect(subject.first.size).not_to be(0) - expect(subject.first.data).to eq('') - end + it 'only loads the metadata' do + expect(subject.first.size).not_to be(0) + expect(subject.first.data).to eq('') end + end - context 'negative' do - let(:blob_size_limit) { -1 } + context 'negative' do + let(:blob_size_limit) { -1 } - it 'ignores MAX_DATA_DISPLAY_SIZE' do - stub_const('Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE', 100) + it 'ignores MAX_DATA_DISPLAY_SIZE' do + stub_const('Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE', 100) - expect(subject.first.data.size).to eq(669) - end + expect(subject.first.data.size).to eq(669) end end end - - context 'when Gitaly list_blobs_by_sha_path feature is enabled' do - it_behaves_like 'loading blobs in batch' - end - - context 'when Gitaly list_blobs_by_sha_path feature is disabled', :disable_gitaly do - it_behaves_like 'loading blobs in batch' - end end describe '.batch_metadata' do @@ -294,58 +284,48 @@ describe Gitlab::Git::Blob, seed_helper: true do ) end - shared_examples 'fetching batch of LFS pointers' do - it 'returns a list of Gitlab::Git::Blob' do - blobs = described_class.batch_lfs_pointers(repository, [lfs_blob.id]) - - expect(blobs.count).to eq(1) - expect(blobs).to all( be_a(Gitlab::Git::Blob) ) - expect(blobs).to be_an(Array) - end - - it 'accepts blob IDs as a lazy enumerator' do - blobs = described_class.batch_lfs_pointers(repository, [lfs_blob.id].lazy) - - expect(blobs.count).to eq(1) - expect(blobs).to all( be_a(Gitlab::Git::Blob) ) - end + it 'returns a list of Gitlab::Git::Blob' do + blobs = described_class.batch_lfs_pointers(repository, [lfs_blob.id]) - it 'handles empty list of IDs gracefully' do - blobs_1 = described_class.batch_lfs_pointers(repository, [].lazy) - blobs_2 = described_class.batch_lfs_pointers(repository, []) + expect(blobs.count).to eq(1) + expect(blobs).to all( be_a(Gitlab::Git::Blob) ) + expect(blobs).to be_an(Array) + end - expect(blobs_1).to eq([]) - expect(blobs_2).to eq([]) - end + it 'accepts blob IDs as a lazy enumerator' do + blobs = described_class.batch_lfs_pointers(repository, [lfs_blob.id].lazy) - it 'silently ignores tree objects' do - blobs = described_class.batch_lfs_pointers(repository, [tree_object.oid]) + expect(blobs.count).to eq(1) + expect(blobs).to all( be_a(Gitlab::Git::Blob) ) + end - expect(blobs).to eq([]) - end + it 'handles empty list of IDs gracefully' do + blobs_1 = described_class.batch_lfs_pointers(repository, [].lazy) + blobs_2 = described_class.batch_lfs_pointers(repository, []) - it 'silently ignores non lfs objects' do - blobs = described_class.batch_lfs_pointers(repository, [non_lfs_blob.id]) + expect(blobs_1).to eq([]) + expect(blobs_2).to eq([]) + end - expect(blobs).to eq([]) - end + it 'silently ignores tree objects' do + blobs = described_class.batch_lfs_pointers(repository, [tree_object.oid]) - it 'avoids loading large blobs into memory' do - # This line could call `lookup` on `repository`, so do here before mocking. - non_lfs_blob_id = non_lfs_blob.id + expect(blobs).to eq([]) + end - expect(repository).not_to receive(:lookup) + it 'silently ignores non lfs objects' do + blobs = described_class.batch_lfs_pointers(repository, [non_lfs_blob.id]) - described_class.batch_lfs_pointers(repository, [non_lfs_blob_id]) - end + expect(blobs).to eq([]) end - context 'when Gitaly batch_lfs_pointers is enabled' do - it_behaves_like 'fetching batch of LFS pointers' - end + it 'avoids loading large blobs into memory' do + # This line could call `lookup` on `repository`, so do here before mocking. + non_lfs_blob_id = non_lfs_blob.id + + expect(repository).not_to receive(:lookup) - context 'when Gitaly batch_lfs_pointers is disabled', :disable_gitaly do - it_behaves_like 'fetching batch of LFS pointers' + described_class.batch_lfs_pointers(repository, [non_lfs_blob_id]) end end diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index e6268a05d44..4f8e6f29255 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1716,59 +1716,51 @@ describe Gitlab::Git::Repository, seed_helper: true do end describe '#fetch_source_branch!' do - shared_examples '#fetch_source_branch!' do - let(:local_ref) { 'refs/merge-requests/1/head' } - let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') } - let(:source_repository) { Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '') } - - after do - ensure_seeds - end + let(:local_ref) { 'refs/merge-requests/1/head' } + let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') } + let(:source_repository) { Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '') } - context 'when the branch exists' do - context 'when the commit does not exist locally' do - let(:source_branch) { 'new-branch-for-fetch-source-branch' } - let(:source_rugged) { Gitlab::GitalyClient::StorageSettings.allow_disk_access { source_repository.rugged } } - let(:new_oid) { new_commit_edit_old_file(source_rugged).oid } + after do + ensure_seeds + end - before do - source_rugged.branches.create(source_branch, new_oid) - end + context 'when the branch exists' do + context 'when the commit does not exist locally' do + let(:source_branch) { 'new-branch-for-fetch-source-branch' } + let(:source_rugged) { Gitlab::GitalyClient::StorageSettings.allow_disk_access { source_repository.rugged } } + let(:new_oid) { new_commit_edit_old_file(source_rugged).oid } - it 'writes the ref' do - expect(repository.fetch_source_branch!(source_repository, source_branch, local_ref)).to eq(true) - expect(repository.commit(local_ref).sha).to eq(new_oid) - end + before do + source_rugged.branches.create(source_branch, new_oid) end - context 'when the commit exists locally' do - let(:source_branch) { 'master' } - let(:expected_oid) { SeedRepo::LastCommit::ID } - - it 'writes the ref' do - # Sanity check: the commit should already exist - expect(repository.commit(expected_oid)).not_to be_nil - - expect(repository.fetch_source_branch!(source_repository, source_branch, local_ref)).to eq(true) - expect(repository.commit(local_ref).sha).to eq(expected_oid) - end + it 'writes the ref' do + expect(repository.fetch_source_branch!(source_repository, source_branch, local_ref)).to eq(true) + expect(repository.commit(local_ref).sha).to eq(new_oid) end end - context 'when the branch does not exist' do - let(:source_branch) { 'definitely-not-master' } + context 'when the commit exists locally' do + let(:source_branch) { 'master' } + let(:expected_oid) { SeedRepo::LastCommit::ID } + + it 'writes the ref' do + # Sanity check: the commit should already exist + expect(repository.commit(expected_oid)).not_to be_nil - it 'does not write the ref' do - expect(repository.fetch_source_branch!(source_repository, source_branch, local_ref)).to eq(false) - expect(repository.commit(local_ref)).to be_nil + expect(repository.fetch_source_branch!(source_repository, source_branch, local_ref)).to eq(true) + expect(repository.commit(local_ref).sha).to eq(expected_oid) end end end - it_behaves_like '#fetch_source_branch!' + context 'when the branch does not exist' do + let(:source_branch) { 'definitely-not-master' } - context 'without gitaly', :skip_gitaly_mock do - it_behaves_like '#fetch_source_branch!' + it 'does not write the ref' do + expect(repository.fetch_source_branch!(source_repository, source_branch, local_ref)).to eq(false) + expect(repository.commit(local_ref)).to be_nil + end end end diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index ff32025253a..832db2bd906 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -13,14 +13,6 @@ describe Gitlab::GitAccess do let(:authentication_abilities) { %i[read_project download_code push_code] } let(:redirected_path) { nil } let(:auth_result_type) { nil } - - let(:access) do - described_class.new(actor, project, - protocol, authentication_abilities: authentication_abilities, - namespace_path: namespace_path, project_path: project_path, - redirected_path: redirected_path, auth_result_type: auth_result_type) - end - let(:changes) { '_any' } let(:push_access_check) { access.check('git-receive-pack', changes) } let(:pull_access_check) { access.check('git-upload-pack', changes) } @@ -48,7 +40,7 @@ describe Gitlab::GitAccess do before do disable_protocol('http') - project.add_master(user) + project.add_maintainer(user) end it 'blocks http push and pull' do @@ -113,7 +105,7 @@ describe Gitlab::GitAccess do context 'when actor is a User' do context 'when the User can read the project' do before do - project.add_master(user) + project.add_maintainer(user) end it 'allows push and pull access' do @@ -254,7 +246,7 @@ describe Gitlab::GitAccess do shared_examples '#check with a key that is not valid' do before do - project.add_master(user) + project.add_maintainer(user) end context 'key is too small' do @@ -307,7 +299,7 @@ describe Gitlab::GitAccess do describe '#add_project_moved_message!', :clean_gitlab_redis_shared_state do before do - project.add_master(user) + project.add_maintainer(user) end context 'when a redirect was not followed to find the project' do @@ -335,7 +327,7 @@ describe Gitlab::GitAccess do describe '#check_authentication_abilities!' do before do - project.add_master(user) + project.add_maintainer(user) end context 'when download' do @@ -381,7 +373,7 @@ describe Gitlab::GitAccess do describe '#check_command_disabled!' do before do - project.add_master(user) + project.add_maintainer(user) end context 'over http' do @@ -529,8 +521,8 @@ describe Gitlab::GitAccess do end describe '#check_download_access!' do - it 'allows masters to pull' do - project.add_master(user) + it 'allows maintainers to pull' do + project.add_maintainer(user) expect { pull_access_check }.not_to raise_error end @@ -542,7 +534,7 @@ describe Gitlab::GitAccess do end it 'disallows blocked users to pull' do - project.add_master(user) + project.add_maintainer(user) user.block expect { pull_access_check }.to raise_unauthorized('Your account has been blocked.') @@ -724,10 +716,11 @@ describe Gitlab::GitAccess do end describe '#check_push_access!' do + let(:unprotected_branch) { 'unprotected_branch' } + before do merge_into_protected_branch end - let(:unprotected_branch) { 'unprotected_branch' } let(:changes) do { push_new_branch: "#{Gitlab::Git::BLANK_SHA} 570e7b2ab refs/heads/wow", @@ -785,7 +778,7 @@ describe Gitlab::GitAccess do aggregate_failures do matrix.each do |action, allowed| - check = -> { access.send(:check_push_access!, changes[action]) } + check = -> { push_changes(changes[action]) } if allowed expect(&check).not_to raise_error, @@ -812,7 +805,7 @@ describe Gitlab::GitAccess do merge_into_protected_branch: true }, - master: { + maintainer: { push_new_branch: true, push_master: true, push_protected_branch: true, @@ -917,7 +910,7 @@ describe Gitlab::GitAccess do end run_permission_checks(permissions_matrix.deep_merge(developer: { push_protected_branch: false, push_all: false, merge_into_protected_branch: false }, - master: { push_protected_branch: false, push_all: false, merge_into_protected_branch: false }, + maintainer: { push_protected_branch: false, push_all: false, merge_into_protected_branch: false }, admin: { push_protected_branch: false, push_all: false, merge_into_protected_branch: false })) end end @@ -989,7 +982,7 @@ describe Gitlab::GitAccess do let(:project) { create(:project, :repository, :read_only) } it 'denies push access' do - project.add_master(user) + project.add_maintainer(user) expect { push_access_check }.to raise_unauthorized('The repository is temporarily read-only. Please try again later.') end @@ -1119,9 +1112,9 @@ describe Gitlab::GitAccess do it_behaves_like 'access after accepting terms' end - describe 'as a master of the project' do + describe 'as a maintainer of the project' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'access after accepting terms' @@ -1152,6 +1145,17 @@ describe Gitlab::GitAccess do private + def access + described_class.new(actor, project, protocol, + authentication_abilities: authentication_abilities, + namespace_path: namespace_path, project_path: project_path, + redirected_path: redirected_path, auth_result_type: auth_result_type) + end + + def push_changes(changes) + access.check('git-receive-pack', changes) + end + def raise_unauthorized(message) raise_error(Gitlab::GitAccess::UnauthorizedError, message) end diff --git a/spec/lib/gitlab/google_code_import/importer_spec.rb b/spec/lib/gitlab/google_code_import/importer_spec.rb index 017facd0f5e..031f57dbc65 100644 --- a/spec/lib/gitlab/google_code_import/importer_spec.rb +++ b/spec/lib/gitlab/google_code_import/importer_spec.rb @@ -15,7 +15,7 @@ describe Gitlab::GoogleCodeImport::Importer do subject { described_class.new(project) } before do - project.add_master(project.creator) + project.add_maintainer(project.creator) project.create_import_data(data: import_data) end diff --git a/spec/lib/gitlab/ci/trace/http_io_spec.rb b/spec/lib/gitlab/http_io_spec.rb index 5474e2f518c..788bddb8f59 100644 --- a/spec/lib/gitlab/ci/trace/http_io_spec.rb +++ b/spec/lib/gitlab/http_io_spec.rb @@ -1,11 +1,14 @@ require 'spec_helper' -describe Gitlab::Ci::Trace::HttpIO do +describe Gitlab::HttpIO do include HttpIOHelpers let(:http_io) { described_class.new(url, size) } - let(:url) { remote_trace_url } - let(:size) { remote_trace_size } + + let(:url) { 'http://object-storage/trace' } + let(:file_path) { expand_fixture_path('trace/sample_trace') } + let(:file_body) { File.read(file_path).force_encoding(Encoding::BINARY) } + let(:size) { File.size(file_path) } describe '#close' do subject { http_io.close } @@ -86,10 +89,10 @@ describe Gitlab::Ci::Trace::HttpIO do describe '#each_line' do subject { http_io.each_line } - let(:string_io) { StringIO.new(remote_trace_body) } + let(:string_io) { StringIO.new(file_body) } before do - stub_remote_trace_206 + stub_remote_url_206(url, file_path) end it 'yields lines' do @@ -99,7 +102,7 @@ describe Gitlab::Ci::Trace::HttpIO do context 'when buckets on GCS' do context 'when BUFFER_SIZE is larger than file size' do before do - stub_remote_trace_200 + stub_remote_url_200(url, file_path) set_larger_buffer_size_than(size) end @@ -117,7 +120,7 @@ describe Gitlab::Ci::Trace::HttpIO do context 'when there are no network issue' do before do - stub_remote_trace_206 + stub_remote_url_206(url, file_path) end context 'when read whole size' do @@ -129,7 +132,7 @@ describe Gitlab::Ci::Trace::HttpIO do end it 'reads a trace' do - is_expected.to eq(remote_trace_body) + is_expected.to eq(file_body) end end @@ -139,7 +142,7 @@ describe Gitlab::Ci::Trace::HttpIO do end it 'reads a trace' do - is_expected.to eq(remote_trace_body) + is_expected.to eq(file_body) end end end @@ -153,7 +156,7 @@ describe Gitlab::Ci::Trace::HttpIO do end it 'reads a trace' do - is_expected.to eq(remote_trace_body[0, length]) + is_expected.to eq(file_body[0, length]) end end @@ -163,7 +166,7 @@ describe Gitlab::Ci::Trace::HttpIO do end it 'reads a trace' do - is_expected.to eq(remote_trace_body[0, length]) + is_expected.to eq(file_body[0, length]) end end end @@ -177,7 +180,7 @@ describe Gitlab::Ci::Trace::HttpIO do end it 'reads a trace' do - is_expected.to eq(remote_trace_body) + is_expected.to eq(file_body) end end @@ -187,7 +190,7 @@ describe Gitlab::Ci::Trace::HttpIO do end it 'reads a trace' do - is_expected.to eq(remote_trace_body) + is_expected.to eq(file_body) end end end @@ -221,11 +224,11 @@ describe Gitlab::Ci::Trace::HttpIO do let(:length) { nil } before do - stub_remote_trace_500 + stub_remote_url_500(url) end it 'reads a trace' do - expect { subject }.to raise_error(Gitlab::Ci::Trace::HttpIO::FailedToGetChunkError) + expect { subject }.to raise_error(Gitlab::HttpIO::FailedToGetChunkError) end end end @@ -233,15 +236,15 @@ describe Gitlab::Ci::Trace::HttpIO do describe '#readline' do subject { http_io.readline } - let(:string_io) { StringIO.new(remote_trace_body) } + let(:string_io) { StringIO.new(file_body) } before do - stub_remote_trace_206 + stub_remote_url_206(url, file_path) end shared_examples 'all line matching' do it 'reads a line' do - (0...remote_trace_body.lines.count).each do + (0...file_body.lines.count).each do expect(http_io.readline).to eq(string_io.readline) end end @@ -251,11 +254,11 @@ describe Gitlab::Ci::Trace::HttpIO do let(:length) { nil } before do - stub_remote_trace_500 + stub_remote_url_500(url) end it 'reads a trace' do - expect { subject }.to raise_error(Gitlab::Ci::Trace::HttpIO::FailedToGetChunkError) + expect { subject }.to raise_error(Gitlab::HttpIO::FailedToGetChunkError) end end diff --git a/spec/lib/gitlab/import_export/members_mapper_spec.rb b/spec/lib/gitlab/import_export/members_mapper_spec.rb index 246f009ad27..67e4c289906 100644 --- a/spec/lib/gitlab/import_export/members_mapper_spec.rb +++ b/spec/lib/gitlab/import_export/members_mapper_spec.rb @@ -111,7 +111,7 @@ describe Gitlab::ImportExport::MembersMapper do end it 'maps the project member if it already exists' do - project.add_master(user2) + project.add_maintainer(user2) expect(members_mapper.map[exported_user_id]).to eq(user2.id) end diff --git a/spec/lib/gitlab/import_export/project_tree_saver_spec.rb b/spec/lib/gitlab/import_export/project_tree_saver_spec.rb index 2b8a11ce8f9..fec8a2af9ab 100644 --- a/spec/lib/gitlab/import_export/project_tree_saver_spec.rb +++ b/spec/lib/gitlab/import_export/project_tree_saver_spec.rb @@ -9,7 +9,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver do let!(:project) { setup_project } before do - project.add_master(user) + project.add_maintainer(user) allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path) allow_any_instance_of(MergeRequest).to receive(:source_branch_sha).and_return('ABCD') allow_any_instance_of(MergeRequest).to receive(:target_branch_sha).and_return('DCBA') @@ -217,8 +217,8 @@ describe Gitlab::ImportExport::ProjectTreeSaver do expect(member_emails).not_to include('group@member.com') end - it 'does not export group members as master' do - Group.first.add_master(user) + it 'does not export group members as maintainer' do + Group.first.add_maintainer(user) expect(member_emails).not_to include('group@member.com') end diff --git a/spec/lib/gitlab/import_export/repo_saver_spec.rb b/spec/lib/gitlab/import_export/repo_saver_spec.rb index 187ec8fcfa2..5a646b4aac8 100644 --- a/spec/lib/gitlab/import_export/repo_saver_spec.rb +++ b/spec/lib/gitlab/import_export/repo_saver_spec.rb @@ -9,7 +9,7 @@ describe Gitlab::ImportExport::RepoSaver do let(:bundler) { described_class.new(project: project, shared: shared) } before do - project.add_master(user) + project.add_maintainer(user) allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path) end diff --git a/spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb b/spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb index 24bc231d5a0..441aa1defe6 100644 --- a/spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb +++ b/spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb @@ -10,7 +10,7 @@ describe Gitlab::ImportExport::WikiRepoSaver do let!(:project_wiki) { ProjectWiki.new(project, user) } before do - project.add_master(user) + project.add_maintainer(user) allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path) project_wiki.wiki project_wiki.create_page("index", "test content") diff --git a/spec/lib/gitlab/middleware/go_spec.rb b/spec/lib/gitlab/middleware/go_spec.rb index b24c9882c0c..7a3a9ab875b 100644 --- a/spec/lib/gitlab/middleware/go_spec.rb +++ b/spec/lib/gitlab/middleware/go_spec.rb @@ -79,7 +79,7 @@ describe Gitlab::Middleware::Go do let(:current_user) { project.creator } before do - project.team.add_master(current_user) + project.team.add_maintainer(current_user) end shared_examples 'authenticated' do diff --git a/spec/lib/gitlab/project_authorizations_spec.rb b/spec/lib/gitlab/project_authorizations_spec.rb index f3cd6961e94..00c62c7bf96 100644 --- a/spec/lib/gitlab/project_authorizations_spec.rb +++ b/spec/lib/gitlab/project_authorizations_spec.rb @@ -41,7 +41,7 @@ describe Gitlab::ProjectAuthorizations do it 'includes the correct access levels' do mapping = map_access_levels(authorizations) - expect(mapping[owned_project.id]).to eq(Gitlab::Access::MASTER) + expect(mapping[owned_project.id]).to eq(Gitlab::Access::MAINTAINER) expect(mapping[other_project.id]).to eq(Gitlab::Access::REPORTER) expect(mapping[group_project.id]).to eq(Gitlab::Access::DEVELOPER) end @@ -62,11 +62,11 @@ describe Gitlab::ProjectAuthorizations do end it 'uses the greatest access level when a user is a member of a nested group' do - nested_group.add_master(user) + nested_group.add_maintainer(user) mapping = map_access_levels(authorizations) - expect(mapping[nested_project.id]).to eq(Gitlab::Access::MASTER) + expect(mapping[nested_project.id]).to eq(Gitlab::Access::MAINTAINER) end end end diff --git a/spec/lib/gitlab/project_search_results_spec.rb b/spec/lib/gitlab/project_search_results_spec.rb index 50224bde722..767a3092c73 100644 --- a/spec/lib/gitlab/project_search_results_spec.rb +++ b/spec/lib/gitlab/project_search_results_spec.rb @@ -385,7 +385,7 @@ describe Gitlab::ProjectSearchResults do let!(:private_project) { create(:project, :private, :repository, creator: creator, namespace: creator.namespace) } let(:team_master) do user = create(:user, username: 'private-project-master') - private_project.add_master(user) + private_project.add_maintainer(user) user end let(:team_reporter) do diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb index c435f988cdd..f8bf896950e 100644 --- a/spec/lib/gitlab/shell_spec.rb +++ b/spec/lib/gitlab/shell_spec.rb @@ -403,46 +403,36 @@ describe Gitlab::Shell do end describe '#create_repository' do - shared_examples '#create_repository' do - let(:repository_storage) { 'default' } - let(:repository_storage_path) do - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - Gitlab.config.repositories.storages[repository_storage].legacy_disk_path - end - end - let(:repo_name) { 'project/path' } - let(:created_path) { File.join(repository_storage_path, repo_name + '.git') } - - after do - FileUtils.rm_rf(created_path) + let(:repository_storage) { 'default' } + let(:repository_storage_path) do + Gitlab::GitalyClient::StorageSettings.allow_disk_access do + Gitlab.config.repositories.storages[repository_storage].legacy_disk_path end + end + let(:repo_name) { 'project/path' } + let(:created_path) { File.join(repository_storage_path, repo_name + '.git') } - it 'creates a repository' do - expect(gitlab_shell.create_repository(repository_storage, repo_name)).to be_truthy - - expect(File.stat(created_path).mode & 0o777).to eq(0o770) + after do + FileUtils.rm_rf(created_path) + end - hooks_path = File.join(created_path, 'hooks') - expect(File.lstat(hooks_path)).to be_symlink - expect(File.realpath(hooks_path)).to eq(gitlab_shell_hooks_path) - end + it 'creates a repository' do + expect(gitlab_shell.create_repository(repository_storage, repo_name)).to be_truthy - it 'returns false when the command fails' do - FileUtils.mkdir_p(File.dirname(created_path)) - # This file will block the creation of the repo's .git directory. That - # should cause #create_repository to fail. - FileUtils.touch(created_path) + expect(File.stat(created_path).mode & 0o777).to eq(0o770) - expect(gitlab_shell.create_repository(repository_storage, repo_name)).to be_falsy - end + hooks_path = File.join(created_path, 'hooks') + expect(File.lstat(hooks_path)).to be_symlink + expect(File.realpath(hooks_path)).to eq(gitlab_shell_hooks_path) end - context 'with gitaly' do - it_behaves_like '#create_repository' - end + it 'returns false when the command fails' do + FileUtils.mkdir_p(File.dirname(created_path)) + # This file will block the creation of the repo's .git directory. That + # should cause #create_repository to fail. + FileUtils.touch(created_path) - context 'without gitaly', :skip_gitaly_mock do - it_behaves_like '#create_repository' + expect(gitlab_shell.create_repository(repository_storage, repo_name)).to be_falsy end end @@ -513,22 +503,12 @@ describe Gitlab::Shell do end end - shared_examples 'fetch_remote' do |gitaly_on| + describe '#fetch_remote' do def fetch_remote(ssh_auth = nil, prune = true) gitlab_shell.fetch_remote(repository.raw_repository, 'remote-name', ssh_auth: ssh_auth, prune: prune) end - def expect_gitlab_projects(fail = false, options = {}) - expect(gitlab_projects).to receive(:fetch_remote).with( - 'remote-name', - timeout, - options - ).and_return(!fail) - - allow(gitlab_projects).to receive(:output).and_return('error') if fail - end - - def expect_gitaly_call(fail, options = {}) + def expect_call(fail, options = {}) receive_fetch_remote = if fail receive(:fetch_remote).and_raise(GRPC::NotFound) @@ -539,16 +519,6 @@ describe Gitlab::Shell do expect_any_instance_of(Gitlab::GitalyClient::RepositoryService).to receive_fetch_remote end - if gitaly_on - def expect_call(fail, options = {}) - expect_gitaly_call(fail, options) - end - else - def expect_call(fail, options = {}) - expect_gitlab_projects(fail, options) - end - end - def build_ssh_auth(opts = {}) defaults = { ssh_import?: true, @@ -634,14 +604,6 @@ describe Gitlab::Shell do expect(fetch_remote(ssh_auth)).to be_truthy end end - end - - describe '#fetch_remote local', :skip_gitaly_mock do - it_should_behave_like 'fetch_remote', false - end - - describe '#fetch_remote gitaly' do - it_should_behave_like 'fetch_remote', true context 'gitaly call' do let(:remote_name) { 'remote-name' } @@ -683,25 +645,6 @@ describe Gitlab::Shell do end.to raise_error(Gitlab::Shell::Error, "error") end end - - context 'without gitaly', :disable_gitaly do - it 'returns true when the command succeeds' do - expect(gitlab_projects).to receive(:import_project).with(import_url, timeout) { true } - - result = gitlab_shell.import_repository(project.repository_storage, project.disk_path, import_url) - - expect(result).to be_truthy - end - - it 'raises an exception when the command fails' do - allow(gitlab_projects).to receive(:output) { 'error' } - expect(gitlab_projects).to receive(:import_project) { false } - - expect do - gitlab_shell.import_repository(project.repository_storage, project.disk_path, import_url) - end.to raise_error(Gitlab::Shell::Error, "error") - end - end end end diff --git a/spec/lib/gitlab/slash_commands/issue_move_spec.rb b/spec/lib/gitlab/slash_commands/issue_move_spec.rb index d41441c9472..9a990e1fad7 100644 --- a/spec/lib/gitlab/slash_commands/issue_move_spec.rb +++ b/spec/lib/gitlab/slash_commands/issue_move_spec.rb @@ -27,7 +27,7 @@ describe Gitlab::SlashCommands::IssueMove, service: true do set(:other_project) { create(:project, namespace: project.namespace) } before do - [project, other_project].each { |prj| prj.add_master(user) } + [project, other_project].each { |prj| prj.add_maintainer(user) } end subject { described_class.new(project, chat_name) } diff --git a/spec/lib/gitlab/slash_commands/issue_new_spec.rb b/spec/lib/gitlab/slash_commands/issue_new_spec.rb index 8e7df946529..724c76ade6e 100644 --- a/spec/lib/gitlab/slash_commands/issue_new_spec.rb +++ b/spec/lib/gitlab/slash_commands/issue_new_spec.rb @@ -8,7 +8,7 @@ describe Gitlab::SlashCommands::IssueNew do let(:regex_match) { described_class.match("issue create bird is the word") } before do - project.add_master(user) + project.add_maintainer(user) end subject do diff --git a/spec/lib/gitlab/slash_commands/issue_search_spec.rb b/spec/lib/gitlab/slash_commands/issue_search_spec.rb index 189e9592f1b..47787307990 100644 --- a/spec/lib/gitlab/slash_commands/issue_search_spec.rb +++ b/spec/lib/gitlab/slash_commands/issue_search_spec.rb @@ -22,7 +22,7 @@ describe Gitlab::SlashCommands::IssueSearch do context 'the user has access' do before do - project.add_master(user) + project.add_maintainer(user) end it 'returns all results' do diff --git a/spec/lib/gitlab/slash_commands/issue_show_spec.rb b/spec/lib/gitlab/slash_commands/issue_show_spec.rb index b1db1638237..5c4ba2736ba 100644 --- a/spec/lib/gitlab/slash_commands/issue_show_spec.rb +++ b/spec/lib/gitlab/slash_commands/issue_show_spec.rb @@ -9,7 +9,7 @@ describe Gitlab::SlashCommands::IssueShow do let(:regex_match) { described_class.match("issue show #{issue.iid}") } before do - project.add_master(user) + project.add_maintainer(user) end subject do diff --git a/spec/lib/gitlab/url_sanitizer_spec.rb b/spec/lib/gitlab/url_sanitizer_spec.rb index fc8991fd31f..758a9bc5a2b 100644 --- a/spec/lib/gitlab/url_sanitizer_spec.rb +++ b/spec/lib/gitlab/url_sanitizer_spec.rb @@ -92,6 +92,7 @@ describe Gitlab::UrlSanitizer do context 'credentials in URL' do where(:url, :credentials) do 'http://foo:bar@example.com' | { user: 'foo', password: 'bar' } + 'http://foo:bar:baz@example.com' | { user: 'foo', password: 'bar:baz' } 'http://:bar@example.com' | { user: nil, password: 'bar' } 'http://foo:@example.com' | { user: 'foo', password: nil } 'http://foo@example.com' | { user: 'foo', password: nil } diff --git a/spec/lib/gitlab/user_access_spec.rb b/spec/lib/gitlab/user_access_spec.rb index 0469d984a40..9da06bb40f4 100644 --- a/spec/lib/gitlab/user_access_spec.rb +++ b/spec/lib/gitlab/user_access_spec.rb @@ -9,8 +9,8 @@ describe Gitlab::UserAccess do describe '#can_push_to_branch?' do describe 'push to none protected branch' do - it 'returns true if user is a master' do - project.add_master(user) + it 'returns true if user is a maintainer' do + project.add_maintainer(user) expect(access.can_push_to_branch?('random_branch')).to be_truthy end @@ -38,8 +38,8 @@ describe Gitlab::UserAccess do expect(access.can_push_to_branch?('master')).to be_truthy end - it 'returns true if user is master' do - empty_project.add_master(user) + it 'returns true if user is maintainer' do + empty_project.add_maintainer(user) expect(project_access.can_push_to_branch?('master')).to be_truthy end @@ -83,8 +83,8 @@ describe Gitlab::UserAccess do expect(access.can_push_to_branch?(branch.name)).to be_truthy end - it 'returns true if user is a master' do - project.add_master(user) + it 'returns true if user is a maintainer' do + project.add_maintainer(user) expect(access.can_push_to_branch?(branch.name)).to be_truthy end @@ -113,8 +113,8 @@ describe Gitlab::UserAccess do @branch = create :protected_branch, :developers_can_push, project: project end - it 'returns true if user is a master' do - project.add_master(user) + it 'returns true if user is a maintainer' do + project.add_maintainer(user) expect(access.can_push_to_branch?(@branch.name)).to be_truthy end @@ -170,8 +170,8 @@ describe Gitlab::UserAccess do @branch = create :protected_branch, :developers_can_merge, project: project end - it 'returns true if user is a master' do - project.add_master(user) + it 'returns true if user is a maintainer' do + project.add_maintainer(user) expect(access.can_merge_to_branch?(@branch.name)).to be_truthy end @@ -192,8 +192,8 @@ describe Gitlab::UserAccess do describe '#can_create_tag?' do describe 'push to none protected tag' do - it 'returns true if user is a master' do - project.add_user(user, :master) + it 'returns true if user is a maintainer' do + project.add_user(user, :maintainer) expect(access.can_create_tag?('random_tag')).to be_truthy end @@ -215,8 +215,8 @@ describe Gitlab::UserAccess do let(:tag) { create(:protected_tag, project: project, name: "test") } let(:not_existing_tag) { create :protected_tag, project: project } - it 'returns true if user is a master' do - project.add_user(user, :master) + it 'returns true if user is a maintainer' do + project.add_user(user, :maintainer) expect(access.can_create_tag?(tag.name)).to be_truthy end @@ -239,8 +239,8 @@ describe Gitlab::UserAccess do @tag = create(:protected_tag, :developers_can_create, project: project) end - it 'returns true if user is a master' do - project.add_user(user, :master) + it 'returns true if user is a maintainer' do + project.add_user(user, :maintainer) expect(access.can_create_tag?(@tag.name)).to be_truthy end @@ -261,8 +261,8 @@ describe Gitlab::UserAccess do describe '#can_delete_branch?' do describe 'delete unprotected branch' do - it 'returns true if user is a master' do - project.add_user(user, :master) + it 'returns true if user is a maintainer' do + project.add_user(user, :maintainer) expect(access.can_delete_branch?('random_branch')).to be_truthy end @@ -283,8 +283,8 @@ describe Gitlab::UserAccess do describe 'delete protected branch' do let(:branch) { create(:protected_branch, project: project, name: "test") } - it 'returns true if user is a master' do - project.add_user(user, :master) + it 'returns true if user is a maintainer' do + project.add_user(user, :maintainer) expect(access.can_delete_branch?(branch.name)).to be_truthy end diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index 7802ff1f5f6..23869f3d2da 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -36,22 +36,20 @@ describe Gitlab::Workhorse do allow(described_class).to receive(:git_archive_cache_disabled?).and_return(cache_disabled) end - context 'when Gitaly workhorse_archive feature is enabled' do - it 'sets the header correctly' do - key, command, params = decode_workhorse_header(subject) + it 'sets the header correctly' do + key, command, params = decode_workhorse_header(subject) - expect(key).to eq('Gitlab-Workhorse-Send-Data') - expect(command).to eq('git-archive') - expect(params).to include(gitaly_params) - end + expect(key).to eq('Gitlab-Workhorse-Send-Data') + expect(command).to eq('git-archive') + expect(params).to include(gitaly_params) + end - context 'when archive caching is disabled' do - let(:cache_disabled) { true } + context 'when archive caching is disabled' do + let(:cache_disabled) { true } - it 'tells workhorse not to use the cache' do - _, _, params = decode_workhorse_header(subject) - expect(params).to include({ 'DisableCache' => true }) - end + it 'tells workhorse not to use the cache' do + _, _, params = decode_workhorse_header(subject) + expect(params).to include({ 'DisableCache' => true }) end end @@ -70,34 +68,22 @@ describe Gitlab::Workhorse do let(:diff_refs) { double(base_sha: "base", head_sha: "head") } subject { described_class.send_git_patch(repository, diff_refs) } - context 'when Gitaly workhorse_send_git_patch feature is enabled' do - it 'sets the header correctly' do - key, command, params = decode_workhorse_header(subject) - - expect(key).to eq("Gitlab-Workhorse-Send-Data") - expect(command).to eq("git-format-patch") - expect(params).to eq({ - 'GitalyServer' => { - address: Gitlab::GitalyClient.address(project.repository_storage), - token: Gitlab::GitalyClient.token(project.repository_storage) - }, - 'RawPatchRequest' => Gitaly::RawPatchRequest.new( - repository: repository.gitaly_repository, - left_commit_id: 'base', - right_commit_id: 'head' - ).to_json - }.deep_stringify_keys) - end - end - - context 'when Gitaly workhorse_send_git_patch feature is disabled', :disable_gitaly do - it 'sets the header correctly' do - key, command, params = decode_workhorse_header(subject) + it 'sets the header correctly' do + key, command, params = decode_workhorse_header(subject) - expect(key).to eq("Gitlab-Workhorse-Send-Data") - expect(command).to eq("git-format-patch") - expect(params).to eq("RepoPath" => repository.path_to_repo, "ShaFrom" => "base", "ShaTo" => "head") - end + expect(key).to eq("Gitlab-Workhorse-Send-Data") + expect(command).to eq("git-format-patch") + expect(params).to eq({ + 'GitalyServer' => { + address: Gitlab::GitalyClient.address(project.repository_storage), + token: Gitlab::GitalyClient.token(project.repository_storage) + }, + 'RawPatchRequest' => Gitaly::RawPatchRequest.new( + repository: repository.gitaly_repository, + left_commit_id: 'base', + right_commit_id: 'head' + ).to_json + }.deep_stringify_keys) end end diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index a9a45367b4a..581132b6672 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -314,6 +314,17 @@ describe Notify do end end + describe 'that are new with a description' do + subject { described_class.new_merge_request_email(merge_request.assignee_id, merge_request.id) } + + it_behaves_like 'it should show Gmail Actions View Merge request link' + it_behaves_like "an unsubscribeable thread" + + it 'contains the description' do + is_expected.to have_body_text(merge_request.description) + end + end + describe 'that have been relabeled' do subject { described_class.relabeled_merge_request_email(recipient.id, merge_request.id, %w[foo bar baz], current_user.id) } @@ -541,7 +552,7 @@ describe Notify do describe 'project access requested' do let(:project) do create(:project, :public, :access_requestable) do |project| - project.add_master(project.owner) + project.add_maintainer(project.owner) end end @@ -616,8 +627,8 @@ describe Notify do end describe 'project invitation' do - let(:master) { create(:user).tap { |u| project.add_master(u) } } - let(:project_member) { invite_to_project(project, inviter: master) } + let(:maintainer) { create(:user).tap { |u| project.add_maintainer(u) } } + let(:project_member) { invite_to_project(project, inviter: maintainer) } subject { described_class.member_invited_email('project', project_member.id, project_member.invite_token) } @@ -636,9 +647,9 @@ describe Notify do describe 'project invitation accepted' do let(:invited_user) { create(:user, name: 'invited user') } - let(:master) { create(:user).tap { |u| project.add_master(u) } } + let(:maintainer) { create(:user).tap { |u| project.add_maintainer(u) } } let(:project_member) do - invitee = invite_to_project(project, inviter: master) + invitee = invite_to_project(project, inviter: maintainer) invitee.accept_invite!(invited_user) invitee end @@ -659,14 +670,14 @@ describe Notify do end describe 'project invitation declined' do - let(:master) { create(:user).tap { |u| project.add_master(u) } } + let(:maintainer) { create(:user).tap { |u| project.add_maintainer(u) } } let(:project_member) do - invitee = invite_to_project(project, inviter: master) + invitee = invite_to_project(project, inviter: maintainer) invitee.decline_invite! invitee end - subject { described_class.member_invite_declined_email('project', project.id, project_member.invite_email, master.id) } + subject { described_class.member_invite_declined_email('project', project.id, project_member.invite_email, maintainer.id) } it_behaves_like 'an email sent from GitLab' it_behaves_like 'it should not have Gmail Actions links' diff --git a/spec/migrations/enqueue_delete_diff_files_workers_spec.rb b/spec/migrations/enqueue_delete_diff_files_workers_spec.rb new file mode 100644 index 00000000000..6bae870920c --- /dev/null +++ b/spec/migrations/enqueue_delete_diff_files_workers_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' +require Rails.root.join('db', 'post_migrate', '20180619121030_enqueue_delete_diff_files_workers.rb') + +describe EnqueueDeleteDiffFilesWorkers, :migration, :sidekiq do + it 'correctly schedules diff files deletion schedulers' do + Sidekiq::Testing.fake! do + expect(BackgroundMigrationWorker) + .to receive(:perform_async) + .with(described_class::SCHEDULER) + .and_call_original + + migrate! + + expect(BackgroundMigrationWorker.jobs.size).to eq(1) + end + end +end diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 234d2d8aa3a..3c96fe76829 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -2687,4 +2687,58 @@ describe Ci::Build do end end end + + describe '#artifacts_metadata_entry' do + set(:build) { create(:ci_build, project: project) } + let(:path) { 'other_artifacts_0.1.2/another-subdirectory/banana_sample.gif' } + + before do + stub_artifacts_object_storage + end + + subject { build.artifacts_metadata_entry(path) } + + context 'when using local storage' do + let!(:metadata) { create(:ci_job_artifact, :metadata, job: build) } + + context 'for existing file' do + it 'does exist' do + is_expected.to be_exists + end + end + + context 'for non-existing file' do + let(:path) { 'invalid-file' } + + it 'does not exist' do + is_expected.not_to be_exists + end + end + end + + context 'when using remote storage' do + include HttpIOHelpers + + let!(:metadata) { create(:ci_job_artifact, :remote_store, :metadata, job: build) } + let(:file_path) { expand_fixture_path('ci_build_artifacts_metadata.gz') } + + before do + stub_remote_url_206(metadata.file.url, file_path) + end + + context 'for existing file' do + it 'does exist' do + is_expected.to be_exists + end + end + + context 'for non-existing file' do + let(:path) { 'invalid-file' } + + it 'does not exist' do + is_expected.not_to be_exists + end + end + end + end end diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb index 1cfd526834c..ec6374f3963 100644 --- a/spec/models/concerns/issuable_spec.rb +++ b/spec/models/concerns/issuable_spec.rb @@ -549,7 +549,7 @@ describe Issuable do let(:project) { create(:project, namespace: group) } let(:other_project) { create(:project) } let(:owner) { create(:owner) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:reporter) { create(:user) } let(:guest) { create(:user) } @@ -558,7 +558,7 @@ describe Issuable do before do group.add_owner(owner) - project.add_master(master) + project.add_maintainer(maintainer) project.add_reporter(reporter) project.add_guest(guest) project.add_guest(contributor) @@ -570,8 +570,8 @@ describe Issuable do let(:merged_mr_other_project) { create(:merge_request, :merged, author: first_time_contributor, target_project: other_project, source_project: other_project) } context "for merge requests" do - it "is false for MASTER" do - mr = create(:merge_request, author: master, target_project: project, source_project: project) + it "is false for MAINTAINER" do + mr = create(:merge_request, author: maintainer, target_project: project, source_project: project) expect(mr).not_to be_first_contribution end diff --git a/spec/models/concerns/protected_ref_access_spec.rb b/spec/models/concerns/protected_ref_access_spec.rb index a62ca391e25..ce602337647 100644 --- a/spec/models/concerns/protected_ref_access_spec.rb +++ b/spec/models/concerns/protected_ref_access_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe ProtectedRefAccess do subject(:protected_ref_access) do - create(:protected_branch, :masters_can_push).push_access_levels.first + create(:protected_branch, :maintainers_can_push).push_access_levels.first end let(:project) { protected_ref_access.project } @@ -14,11 +14,11 @@ describe ProtectedRefAccess do expect(protected_ref_access.check_access(admin)).to be_truthy end - it 'is true for masters' do - master = create(:user) - project.add_master(master) + it 'is true for maintainers' do + maintainer = create(:user) + project.add_maintainer(maintainer) - expect(protected_ref_access.check_access(master)).to be_truthy + expect(protected_ref_access.check_access(maintainer)).to be_truthy end it 'is for developers of the project' do diff --git a/spec/models/concerns/resolvable_discussion_spec.rb b/spec/models/concerns/resolvable_discussion_spec.rb index 2f9f63ce7e0..97b046b0f21 100644 --- a/spec/models/concerns/resolvable_discussion_spec.rb +++ b/spec/models/concerns/resolvable_discussion_spec.rb @@ -190,7 +190,7 @@ describe Discussion, ResolvableDiscussion do context "when the signed in user can push to the project" do before do - subject.project.add_master(current_user) + subject.project.add_maintainer(current_user) end it "returns true" do diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index aeec485358e..0729eb99e78 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -177,7 +177,7 @@ describe Group do describe 'when the user has access to a group' do before do - group.add_user(user, Gitlab::Access::MASTER) + group.add_user(user, Gitlab::Access::MAINTAINER) end it { is_expected.to eq([group]) } @@ -229,10 +229,10 @@ describe Group do let(:user) { create(:user) } before do - group.add_user(user, GroupMember::MASTER) + group.add_user(user, GroupMember::MAINTAINER) end - it { expect(group.group_members.masters.map(&:user)).to include(user) } + it { expect(group.group_members.maintainers.map(&:user)).to include(user) } end describe '#add_users' do @@ -254,7 +254,7 @@ describe Group do let(:user) { create(:user) } before do - group.add_user(user, GroupMember::MASTER) + group.add_user(user, GroupMember::MAINTAINER) end it "is true if avatar is image" do @@ -274,7 +274,7 @@ describe Group do context 'when avatar file is uploaded' do before do - group.add_master(user) + group.add_maintainer(user) end it 'shows correct avatar url' do @@ -317,7 +317,7 @@ describe Group do end it { expect(group.has_owner?(@members[:owner])).to be_truthy } - it { expect(group.has_owner?(@members[:master])).to be_falsey } + it { expect(group.has_owner?(@members[:maintainer])).to be_falsey } it { expect(group.has_owner?(@members[:developer])).to be_falsey } it { expect(group.has_owner?(@members[:reporter])).to be_falsey } it { expect(group.has_owner?(@members[:guest])).to be_falsey } @@ -325,19 +325,19 @@ describe Group do it { expect(group.has_owner?(nil)).to be_falsey } end - describe '#has_master?' do + describe '#has_maintainer?' do before do @members = setup_group_members(group) - create(:group_member, :invited, :master, group: group) + create(:group_member, :invited, :maintainer, group: group) end - it { expect(group.has_master?(@members[:owner])).to be_falsey } - it { expect(group.has_master?(@members[:master])).to be_truthy } - it { expect(group.has_master?(@members[:developer])).to be_falsey } - it { expect(group.has_master?(@members[:reporter])).to be_falsey } - it { expect(group.has_master?(@members[:guest])).to be_falsey } - it { expect(group.has_master?(@members[:requester])).to be_falsey } - it { expect(group.has_master?(nil)).to be_falsey } + it { expect(group.has_maintainer?(@members[:owner])).to be_falsey } + it { expect(group.has_maintainer?(@members[:maintainer])).to be_truthy } + it { expect(group.has_maintainer?(@members[:developer])).to be_falsey } + it { expect(group.has_maintainer?(@members[:reporter])).to be_falsey } + it { expect(group.has_maintainer?(@members[:guest])).to be_falsey } + it { expect(group.has_maintainer?(@members[:requester])).to be_falsey } + it { expect(group.has_maintainer?(nil)).to be_falsey } end describe '#lfs_enabled?' do @@ -401,7 +401,7 @@ describe Group do def setup_group_members(group) members = { owner: create(:user), - master: create(:user), + maintainer: create(:user), developer: create(:user), reporter: create(:user), guest: create(:user), @@ -409,7 +409,7 @@ describe Group do } group.add_user(members[:owner], GroupMember::OWNER) - group.add_user(members[:master], GroupMember::MASTER) + group.add_user(members[:maintainer], GroupMember::MAINTAINER) group.add_user(members[:developer], GroupMember::DEVELOPER) group.add_user(members[:reporter], GroupMember::REPORTER) group.add_user(members[:guest], GroupMember::GUEST) @@ -439,25 +439,25 @@ describe Group do describe '#members_with_parents', :nested_groups do let!(:group) { create(:group, :nested) } - let!(:master) { group.parent.add_user(create(:user), GroupMember::MASTER) } + let!(:maintainer) { group.parent.add_user(create(:user), GroupMember::MAINTAINER) } let!(:developer) { group.add_user(create(:user), GroupMember::DEVELOPER) } it 'returns parents members' do expect(group.members_with_parents).to include(developer) - expect(group.members_with_parents).to include(master) + expect(group.members_with_parents).to include(maintainer) end end describe '#direct_and_indirect_members', :nested_groups do let!(:group) { create(:group, :nested) } let!(:sub_group) { create(:group, parent: group) } - let!(:master) { group.parent.add_user(create(:user), GroupMember::MASTER) } + let!(:maintainer) { group.parent.add_user(create(:user), GroupMember::MAINTAINER) } let!(:developer) { group.add_user(create(:user), GroupMember::DEVELOPER) } let!(:other_developer) { group.add_user(create(:user), GroupMember::DEVELOPER) } it 'returns parents members' do expect(group.direct_and_indirect_members).to include(developer) - expect(group.direct_and_indirect_members).to include(master) + expect(group.direct_and_indirect_members).to include(maintainer) end it 'returns descendant members' do @@ -539,14 +539,14 @@ describe Group do describe '#user_ids_for_project_authorizations' do it 'returns the user IDs for which to refresh authorizations' do - master = create(:user) + maintainer = create(:user) developer = create(:user) - group.add_user(master, GroupMember::MASTER) + group.add_user(maintainer, GroupMember::MAINTAINER) group.add_user(developer, GroupMember::DEVELOPER) expect(group.user_ids_for_project_authorizations) - .to include(master.id, developer.id) + .to include(maintainer.id, developer.id) end end diff --git a/spec/models/hooks/system_hook_spec.rb b/spec/models/hooks/system_hook_spec.rb index 8bc45715dcd..01129df1107 100644 --- a/spec/models/hooks/system_hook_spec.rb +++ b/spec/models/hooks/system_hook_spec.rb @@ -63,7 +63,7 @@ describe SystemHook do end it "project_create hook" do - project.add_master(user) + project.add_maintainer(user) expect(WebMock).to have_requested(:post, system_hook.url).with( body: /user_add_to_team/, @@ -72,7 +72,7 @@ describe SystemHook do end it "project_destroy hook" do - project.add_master(user) + project.add_maintainer(user) project.project_members.destroy_all expect(WebMock).to have_requested(:post, system_hook.url).with( @@ -100,7 +100,7 @@ describe SystemHook do end it 'group member create hook' do - group.add_master(user) + group.add_maintainer(user) expect(WebMock).to have_requested(:post, system_hook.url).with( body: /user_add_to_group/, @@ -109,7 +109,7 @@ describe SystemHook do end it 'group member destroy hook' do - group.add_master(user) + group.add_maintainer(user) group.group_members.destroy_all expect(WebMock).to have_requested(:post, system_hook.url).with( diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index e818fbeb9cf..84edfc3ff00 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -669,7 +669,7 @@ describe Issue do context 'when the user is the project owner' do before do - project.add_master(user) + project.add_maintainer(user) end it 'returns true for a regular issue' do diff --git a/spec/models/lfs_file_lock_spec.rb b/spec/models/lfs_file_lock_spec.rb index ce87b01b49c..e74f342d3eb 100644 --- a/spec/models/lfs_file_lock_spec.rb +++ b/spec/models/lfs_file_lock_spec.rb @@ -13,13 +13,13 @@ describe LfsFileLock do describe '#can_be_unlocked_by?' do let(:developer) { create(:user) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } before do project = lfs_file_lock.project project.add_developer(developer) - project.add_master(master) + project.add_maintainer(maintainer) end context "when it's forced" do @@ -29,8 +29,8 @@ describe LfsFileLock do expect(lfs_file_lock.can_be_unlocked_by?(user, true)).to eq(true) end - it 'can be unlocked by a master' do - expect(lfs_file_lock.can_be_unlocked_by?(master, true)).to eq(true) + it 'can be unlocked by a maintainer' do + expect(lfs_file_lock.can_be_unlocked_by?(maintainer, true)).to eq(true) end it "can't be unlocked by other user" do @@ -45,8 +45,8 @@ describe LfsFileLock do expect(lfs_file_lock.can_be_unlocked_by?(user)).to eq(true) end - it "can't be unlocked by a master" do - expect(lfs_file_lock.can_be_unlocked_by?(master)).to eq(false) + it "can't be unlocked by a maintainer" do + expect(lfs_file_lock.can_be_unlocked_by?(maintainer)).to eq(false) end it "can't be unlocked by other user" do diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index c64cdf8f812..fca1b1f90d9 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -62,16 +62,16 @@ describe Member do @owner_user = create(:user).tap { |u| group.add_owner(u) } @owner = group.members.find_by(user_id: @owner_user.id) - @master_user = create(:user).tap { |u| project.add_master(u) } - @master = project.members.find_by(user_id: @master_user.id) + @maintainer_user = create(:user).tap { |u| project.add_maintainer(u) } + @maintainer = project.members.find_by(user_id: @maintainer_user.id) @blocked_user = create(:user).tap do |u| - project.add_master(u) + project.add_maintainer(u) project.add_developer(u) u.block! end - @blocked_master = project.members.find_by(user_id: @blocked_user.id, access_level: Gitlab::Access::MASTER) + @blocked_maintainer = project.members.find_by(user_id: @blocked_user.id, access_level: Gitlab::Access::MAINTAINER) @blocked_developer = project.members.find_by(user_id: @blocked_user.id, access_level: Gitlab::Access::DEVELOPER) @invited_member = create(:project_member, :developer, @@ -95,10 +95,10 @@ describe Member do describe '.access_for_user_ids' do it 'returns the right access levels' do - users = [@owner_user.id, @master_user.id, @blocked_user.id] + users = [@owner_user.id, @maintainer_user.id, @blocked_user.id] expected = { @owner_user.id => Gitlab::Access::OWNER, - @master_user.id => Gitlab::Access::MASTER + @maintainer_user.id => Gitlab::Access::MAINTAINER } expect(described_class.access_for_user_ids(users)).to eq(expected) @@ -106,7 +106,7 @@ describe Member do end describe '.invite' do - it { expect(described_class.invite).not_to include @master } + it { expect(described_class.invite).not_to include @maintainer } it { expect(described_class.invite).to include @invited_member } it { expect(described_class.invite).not_to include @accepted_invite_member } it { expect(described_class.invite).not_to include @requested_member } @@ -114,7 +114,7 @@ describe Member do end describe '.non_invite' do - it { expect(described_class.non_invite).to include @master } + it { expect(described_class.non_invite).to include @maintainer } it { expect(described_class.non_invite).not_to include @invited_member } it { expect(described_class.non_invite).to include @accepted_invite_member } it { expect(described_class.non_invite).to include @requested_member } @@ -122,7 +122,7 @@ describe Member do end describe '.request' do - it { expect(described_class.request).not_to include @master } + it { expect(described_class.request).not_to include @maintainer } it { expect(described_class.request).not_to include @invited_member } it { expect(described_class.request).not_to include @accepted_invite_member } it { expect(described_class.request).to include @requested_member } @@ -130,7 +130,7 @@ describe Member do end describe '.non_request' do - it { expect(described_class.non_request).to include @master } + it { expect(described_class.non_request).to include @maintainer } it { expect(described_class.non_request).to include @invited_member } it { expect(described_class.non_request).to include @accepted_invite_member } it { expect(described_class.non_request).not_to include @requested_member } @@ -141,35 +141,35 @@ describe Member do subject { described_class.developers.to_a } it { is_expected.not_to include @owner } - it { is_expected.not_to include @master } + it { is_expected.not_to include @maintainer } it { is_expected.to include @invited_member } it { is_expected.to include @accepted_invite_member } it { is_expected.not_to include @requested_member } it { is_expected.to include @accepted_request_member } - it { is_expected.not_to include @blocked_master } + it { is_expected.not_to include @blocked_maintainer } it { is_expected.not_to include @blocked_developer } end - describe '.owners_and_masters' do - it { expect(described_class.owners_and_masters).to include @owner } - it { expect(described_class.owners_and_masters).to include @master } - it { expect(described_class.owners_and_masters).not_to include @invited_member } - it { expect(described_class.owners_and_masters).not_to include @accepted_invite_member } - it { expect(described_class.owners_and_masters).not_to include @requested_member } - it { expect(described_class.owners_and_masters).not_to include @accepted_request_member } - it { expect(described_class.owners_and_masters).not_to include @blocked_master } + describe '.owners_and_maintainers' do + it { expect(described_class.owners_and_maintainers).to include @owner } + it { expect(described_class.owners_and_maintainers).to include @maintainer } + it { expect(described_class.owners_and_maintainers).not_to include @invited_member } + it { expect(described_class.owners_and_maintainers).not_to include @accepted_invite_member } + it { expect(described_class.owners_and_maintainers).not_to include @requested_member } + it { expect(described_class.owners_and_maintainers).not_to include @accepted_request_member } + it { expect(described_class.owners_and_maintainers).not_to include @blocked_maintainer } end describe '.has_access' do subject { described_class.has_access.to_a } it { is_expected.to include @owner } - it { is_expected.to include @master } + it { is_expected.to include @maintainer } it { is_expected.to include @invited_member } it { is_expected.to include @accepted_invite_member } it { is_expected.not_to include @requested_member } it { is_expected.to include @accepted_request_member } - it { is_expected.not_to include @blocked_master } + it { is_expected.not_to include @blocked_maintainer } it { is_expected.not_to include @blocked_developer } end end @@ -187,20 +187,20 @@ describe Member do let!(:admin) { create(:admin) } it 'returns a <Source>Member object' do - member = described_class.add_user(source, user, :master) + member = described_class.add_user(source, user, :maintainer) expect(member).to be_a "#{source_type.classify}Member".constantize expect(member).to be_persisted end it 'sets members.created_by to the given current_user' do - member = described_class.add_user(source, user, :master, current_user: admin) + member = described_class.add_user(source, user, :maintainer, current_user: admin) expect(member.created_by).to eq(admin) end it 'sets members.expires_at to the given expires_at' do - member = described_class.add_user(source, user, :master, expires_at: Date.new(2016, 9, 22)) + member = described_class.add_user(source, user, :maintainer, expires_at: Date.new(2016, 9, 22)) expect(member.expires_at).to eq(Date.new(2016, 9, 22)) end @@ -230,7 +230,7 @@ describe Member do it 'adds the user as a member' do expect(source.users).not_to include(user) - described_class.add_user(source, user.id, :master) + described_class.add_user(source, user.id, :maintainer) expect(source.users.reload).to include(user) end @@ -240,7 +240,7 @@ describe Member do it 'adds the user as a member' do expect(source.users).not_to include(user) - described_class.add_user(source, 42, :master) + described_class.add_user(source, 42, :maintainer) expect(source.users.reload).not_to include(user) end @@ -250,7 +250,7 @@ describe Member do it 'adds the user as a member' do expect(source.users).not_to include(user) - described_class.add_user(source, user, :master) + described_class.add_user(source, user, :maintainer) expect(source.users.reload).to include(user) end @@ -265,7 +265,7 @@ describe Member do expect(source.users).not_to include(user) expect(source.requesters.exists?(user_id: user)).to be_truthy - expect { described_class.add_user(source, user, :master) } + expect { described_class.add_user(source, user, :maintainer) } .to raise_error(Gitlab::Access::AccessDeniedError) expect(source.users.reload).not_to include(user) @@ -277,7 +277,7 @@ describe Member do it 'adds the user as a member' do expect(source.users).not_to include(user) - described_class.add_user(source, user.email, :master) + described_class.add_user(source, user.email, :maintainer) expect(source.users.reload).to include(user) end @@ -287,7 +287,7 @@ describe Member do it 'creates an invited member' do expect(source.users).not_to include(user) - described_class.add_user(source, 'user@example.com', :master) + described_class.add_user(source, 'user@example.com', :maintainer) expect(source.members.invite.pluck(:invite_email)).to include('user@example.com') end @@ -298,7 +298,7 @@ describe Member do it 'creates the member' do expect(source.users).not_to include(user) - described_class.add_user(source, user, :master, current_user: admin) + described_class.add_user(source, user, :maintainer, current_user: admin) expect(source.users.reload).to include(user) end @@ -312,7 +312,7 @@ describe Member do expect(source.users).not_to include(user) expect(source.requesters.exists?(user_id: user)).to be_truthy - described_class.add_user(source, user, :master, current_user: admin) + described_class.add_user(source, user, :maintainer, current_user: admin) expect(source.users.reload).to include(user) expect(source.requesters.reload.exists?(user_id: user)).to be_falsy @@ -324,7 +324,7 @@ describe Member do it 'does not create the member' do expect(source.users).not_to include(user) - member = described_class.add_user(source, user, :master, current_user: user) + member = described_class.add_user(source, user, :maintainer, current_user: user) expect(source.users.reload).not_to include(user) expect(member).not_to be_persisted @@ -339,7 +339,7 @@ describe Member do expect(source.users).not_to include(user) expect(source.requesters.exists?(user_id: user)).to be_truthy - described_class.add_user(source, user, :master, current_user: user) + described_class.add_user(source, user, :maintainer, current_user: user) expect(source.users.reload).not_to include(user) expect(source.requesters.exists?(user_id: user)).to be_truthy @@ -356,9 +356,9 @@ describe Member do it 'updates the member' do expect(source.users).to include(user) - described_class.add_user(source, user, :master) + described_class.add_user(source, user, :maintainer) - expect(source.members.find_by(user_id: user).access_level).to eq(Gitlab::Access::MASTER) + expect(source.members.find_by(user_id: user).access_level).to eq(Gitlab::Access::MAINTAINER) end end @@ -366,9 +366,9 @@ describe Member do it 'updates the member' do expect(source.users).to include(user) - described_class.add_user(source, user, :master, current_user: admin) + described_class.add_user(source, user, :maintainer, current_user: admin) - expect(source.members.find_by(user_id: user).access_level).to eq(Gitlab::Access::MASTER) + expect(source.members.find_by(user_id: user).access_level).to eq(Gitlab::Access::MAINTAINER) end end @@ -376,7 +376,7 @@ describe Member do it 'does not update the member' do expect(source.users).to include(user) - described_class.add_user(source, user, :master, current_user: user) + described_class.add_user(source, user, :maintainer, current_user: user) expect(source.members.find_by(user_id: user).access_level).to eq(Gitlab::Access::DEVELOPER) end @@ -395,7 +395,7 @@ describe Member do let(:user2) { create(:user) } it 'returns a <Source>Member objects' do - members = described_class.add_users(source, [user1, user2], :master) + members = described_class.add_users(source, [user1, user2], :maintainer) expect(members).to be_a Array expect(members.size).to eq(2) @@ -404,7 +404,7 @@ describe Member do end it 'returns an empty array' do - members = described_class.add_users(source, [], :master) + members = described_class.add_users(source, [], :maintainer) expect(members).to be_a Array expect(members).to be_empty @@ -413,7 +413,7 @@ describe Member do it 'supports differents formats' do list = ['joe@local.test', admin, user1.id, user2.id.to_s] - members = described_class.add_users(source, list, :master) + members = described_class.add_users(source, list, :maintainer) expect(members.size).to eq(4) expect(members.first).to be_invite diff --git a/spec/models/members/group_member_spec.rb b/spec/models/members/group_member_spec.rb index ffc78015f94..97959ed4304 100644 --- a/spec/models/members/group_member_spec.rb +++ b/spec/models/members/group_member_spec.rb @@ -21,7 +21,7 @@ describe GroupMember do described_class.add_users( group, [users.first.id, users.second], - described_class::MASTER + described_class::MAINTAINER ) expect(group.users).to include(users.first, users.second) diff --git a/spec/models/members/project_member_spec.rb b/spec/models/members/project_member_spec.rb index 574eb468e4c..334d4f95f53 100644 --- a/spec/models/members/project_member_spec.rb +++ b/spec/models/members/project_member_spec.rb @@ -28,7 +28,7 @@ describe ProjectMember do expect(project.users).not_to include(user) - described_class.add_user(project, user, :master, current_user: project.owner) + described_class.add_user(project, user, :maintainer, current_user: project.owner) expect(project.users.reload).to include(user) end @@ -41,9 +41,9 @@ describe ProjectMember do end describe "#destroy" do - let(:owner) { create(:project_member, access_level: ProjectMember::MASTER) } + let(:owner) { create(:project_member, access_level: ProjectMember::MAINTAINER) } let(:project) { owner.project } - let(:master) { create(:project_member, project: project) } + let(:maintainer) { create(:project_member, project: project) } it "creates an expired event when left due to expiry" do expired = create(:project_member, project: project, expires_at: Time.now - 6.days) @@ -52,7 +52,7 @@ describe ProjectMember do end it "creates a left event when left due to leave" do - master.destroy + maintainer.destroy expect(Event.recent.first.action).to eq(Event::LEFT) end end @@ -95,7 +95,7 @@ describe ProjectMember do described_class.add_users_to_projects( [projects.first.id, projects.second.id], [users.first.id, users.second], - described_class::MASTER) + described_class::MAINTAINER) expect(projects.first.users).to include(users.first) expect(projects.first.users).to include(users.second) diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index c7eead2bdaa..b0d9d03bf6c 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -724,7 +724,7 @@ describe MergeRequest do subject { merge_request } before do - subject.source_project.add_master(user) + subject.source_project.add_maintainer(user) end it "can't be removed when its a protected branch" do @@ -1199,7 +1199,7 @@ describe MergeRequest do end before do - project.add_master(current_user) + project.add_maintainer(current_user) ProcessCommitWorker.new.perform(project.id, current_user.id, @@ -1569,8 +1569,8 @@ describe MergeRequest do let(:merge_request) { create(:merge_request, source_project: project) } before do - merge_request.source_project.add_master(user) - merge_request.target_project.add_master(user) + merge_request.source_project.add_maintainer(user) + merge_request.target_project.add_maintainer(user) end context 'with multiple environments' do diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index a2cb716cb93..947be44c903 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -144,8 +144,8 @@ describe Note do describe 'admin' do before do @p1.project_members.create(user: @u1, access_level: ProjectMember::REPORTER) - @p1.project_members.create(user: @u2, access_level: ProjectMember::MASTER) - @p2.project_members.create(user: @u3, access_level: ProjectMember::MASTER) + @p1.project_members.create(user: @u2, access_level: ProjectMember::MAINTAINER) + @p2.project_members.create(user: @u3, access_level: ProjectMember::MAINTAINER) end it { expect(Ability.allowed?(@u1, :admin_note, @p1)).to be_falsey } @@ -225,7 +225,7 @@ describe Note do describe "cross_reference_not_visible_for?" do let(:private_user) { create(:user) } - let(:private_project) { create(:project, namespace: private_user.namespace) { |p| p.add_master(private_user) } } + let(:private_project) { create(:project, namespace: private_user.namespace) { |p| p.add_maintainer(private_user) } } let(:private_issue) { create(:issue, project: private_project) } let(:ext_proj) { create(:project, :public) } diff --git a/spec/models/project_authorization_spec.rb b/spec/models/project_authorization_spec.rb index 9e7e525b2c0..c289ee0859a 100644 --- a/spec/models/project_authorization_spec.rb +++ b/spec/models/project_authorization_spec.rb @@ -8,15 +8,15 @@ describe ProjectAuthorization do describe '.insert_authorizations' do it 'inserts the authorizations' do described_class - .insert_authorizations([[user.id, project1.id, Gitlab::Access::MASTER]]) + .insert_authorizations([[user.id, project1.id, Gitlab::Access::MAINTAINER]]) expect(user.project_authorizations.count).to eq(1) end it 'inserts rows in batches' do described_class.insert_authorizations([ - [user.id, project1.id, Gitlab::Access::MASTER], - [user.id, project2.id, Gitlab::Access::MASTER] + [user.id, project1.id, Gitlab::Access::MAINTAINER], + [user.id, project2.id, Gitlab::Access::MAINTAINER] ], 1) expect(user.project_authorizations.count).to eq(2) diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index bbf37ca59b9..c01c7bc47b5 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -336,7 +336,7 @@ describe Project do end describe 'delegation' do - [:add_guest, :add_reporter, :add_developer, :add_master, :add_user, :add_users].each do |method| + [:add_guest, :add_reporter, :add_developer, :add_maintainer, :add_user, :add_users].each do |method| it { is_expected.to delegate_method(method).to(:team) } end @@ -1130,7 +1130,7 @@ describe Project do describe 'when a user has access to a project' do before do - project.add_user(user, Gitlab::Access::MASTER) + project.add_user(user, Gitlab::Access::MAINTAINER) end it { is_expected.to eq([project]) } @@ -3496,8 +3496,8 @@ describe Project do expect(project.protected_branches).not_to be_empty expect(project.default_branch).to eq(project.protected_branches.first.name) - expect(project.protected_branches.first.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER]) - expect(project.protected_branches.first.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER]) + expect(project.protected_branches.first.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MAINTAINER]) + expect(project.protected_branches.first.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MAINTAINER]) end end end @@ -3733,7 +3733,7 @@ describe Project do end it 'does not allow access if the user cannot merge the merge request' do - create(:protected_branch, :masters_can_push, project: target_project, name: 'target-branch') + create(:protected_branch, :maintainers_can_push, project: target_project, name: 'target-branch') expect(project.branch_allows_collaboration?(user, 'awesome-feature-1')) .to be_falsy diff --git a/spec/models/project_team_spec.rb b/spec/models/project_team_spec.rb index 9978f3e9566..c4af17f4726 100644 --- a/spec/models/project_team_spec.rb +++ b/spec/models/project_team_spec.rb @@ -1,7 +1,7 @@ require "spec_helper" describe ProjectTeam do - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:reporter) { create(:user) } let(:guest) { create(:user) } let(:nonmember) { create(:user) } @@ -10,23 +10,23 @@ describe ProjectTeam do let(:project) { create(:project) } before do - project.add_master(master) + project.add_maintainer(maintainer) project.add_reporter(reporter) project.add_guest(guest) end describe 'members collection' do - it { expect(project.team.masters).to include(master) } - it { expect(project.team.masters).not_to include(guest) } - it { expect(project.team.masters).not_to include(reporter) } - it { expect(project.team.masters).not_to include(nonmember) } + it { expect(project.team.maintainers).to include(maintainer) } + it { expect(project.team.maintainers).not_to include(guest) } + it { expect(project.team.maintainers).not_to include(reporter) } + it { expect(project.team.maintainers).not_to include(nonmember) } end describe 'access methods' do - it { expect(project.team.master?(master)).to be_truthy } - it { expect(project.team.master?(guest)).to be_falsey } - it { expect(project.team.master?(reporter)).to be_falsey } - it { expect(project.team.master?(nonmember)).to be_falsey } + it { expect(project.team.maintainer?(maintainer)).to be_truthy } + it { expect(project.team.maintainer?(guest)).to be_falsey } + it { expect(project.team.maintainer?(reporter)).to be_falsey } + it { expect(project.team.maintainer?(nonmember)).to be_falsey } it { expect(project.team.member?(nonmember)).to be_falsey } it { expect(project.team.member?(guest)).to be_truthy } it { expect(project.team.member?(reporter, Gitlab::Access::REPORTER)).to be_truthy } @@ -40,35 +40,35 @@ describe ProjectTeam do let!(:project) { create(:project, group: group) } before do - group.add_master(master) + group.add_maintainer(maintainer) group.add_reporter(reporter) group.add_guest(guest) # If user is a group and a project member - GitLab uses highest permission - # So we add group guest as master and add group master as guest + # So we add group guest as maintainer and add group maintainer as guest # to this project to test highest access - project.add_master(guest) - project.add_guest(master) + project.add_maintainer(guest) + project.add_guest(maintainer) end describe 'members collection' do it { expect(project.team.reporters).to include(reporter) } - it { expect(project.team.masters).to include(master) } - it { expect(project.team.masters).to include(guest) } - it { expect(project.team.masters).not_to include(reporter) } - it { expect(project.team.masters).not_to include(nonmember) } + it { expect(project.team.maintainers).to include(maintainer) } + it { expect(project.team.maintainers).to include(guest) } + it { expect(project.team.maintainers).not_to include(reporter) } + it { expect(project.team.maintainers).not_to include(nonmember) } end describe 'access methods' do it { expect(project.team.reporter?(reporter)).to be_truthy } - it { expect(project.team.master?(master)).to be_truthy } - it { expect(project.team.master?(guest)).to be_truthy } - it { expect(project.team.master?(reporter)).to be_falsey } - it { expect(project.team.master?(nonmember)).to be_falsey } + it { expect(project.team.maintainer?(maintainer)).to be_truthy } + it { expect(project.team.maintainer?(guest)).to be_truthy } + it { expect(project.team.maintainer?(reporter)).to be_falsey } + it { expect(project.team.maintainer?(nonmember)).to be_falsey } it { expect(project.team.member?(nonmember)).to be_falsey } it { expect(project.team.member?(guest)).to be_truthy } - it { expect(project.team.member?(guest, Gitlab::Access::MASTER)).to be_truthy } - it { expect(project.team.member?(reporter, Gitlab::Access::MASTER)).to be_falsey } + it { expect(project.team.member?(guest, Gitlab::Access::MAINTAINER)).to be_truthy } + it { expect(project.team.member?(reporter, Gitlab::Access::MAINTAINER)).to be_falsey } it { expect(project.team.member?(nonmember, Gitlab::Access::GUEST)).to be_falsey } end end @@ -145,13 +145,13 @@ describe ProjectTeam do let(:requester) { create(:user) } before do - project.add_master(master) + project.add_maintainer(maintainer) project.add_reporter(reporter) project.add_guest(guest) project.request_access(requester) end - it { expect(project.team.find_member(master.id)).to be_a(ProjectMember) } + it { expect(project.team.find_member(maintainer.id)).to be_a(ProjectMember) } it { expect(project.team.find_member(reporter.id)).to be_a(ProjectMember) } it { expect(project.team.find_member(guest.id)).to be_a(ProjectMember) } it { expect(project.team.find_member(nonmember.id)).to be_nil } @@ -164,13 +164,13 @@ describe ProjectTeam do let(:requester) { create(:user) } before do - group.add_master(master) + group.add_maintainer(maintainer) group.add_reporter(reporter) group.add_guest(guest) group.request_access(requester) end - it { expect(project.team.find_member(master.id)).to be_a(GroupMember) } + it { expect(project.team.find_member(maintainer.id)).to be_a(GroupMember) } it { expect(project.team.find_member(reporter.id)).to be_a(GroupMember) } it { expect(project.team.find_member(guest.id)).to be_a(GroupMember) } it { expect(project.team.find_member(nonmember.id)).to be_nil } @@ -184,7 +184,7 @@ describe ProjectTeam do group = create(:group) project = create(:project, namespace: group) - group.add_master(user) + group.add_maintainer(user) expect(project.team.human_max_access(user.id)).to eq 'Maintainer' end @@ -210,13 +210,13 @@ describe ProjectTeam do context 'when project is not shared with group' do before do - project.add_master(master) + project.add_maintainer(maintainer) project.add_reporter(reporter) project.add_guest(guest) project.request_access(requester) end - it { expect(project.team.max_member_access(master.id)).to eq(Gitlab::Access::MASTER) } + it { expect(project.team.max_member_access(maintainer.id)).to eq(Gitlab::Access::MAINTAINER) } it { expect(project.team.max_member_access(reporter.id)).to eq(Gitlab::Access::REPORTER) } it { expect(project.team.max_member_access(guest.id)).to eq(Gitlab::Access::GUEST) } it { expect(project.team.max_member_access(nonmember.id)).to eq(Gitlab::Access::NO_ACCESS) } @@ -230,11 +230,11 @@ describe ProjectTeam do group: group, group_access: Gitlab::Access::DEVELOPER) - group.add_master(master) + group.add_maintainer(maintainer) group.add_reporter(reporter) end - it { expect(project.team.max_member_access(master.id)).to eq(Gitlab::Access::DEVELOPER) } + it { expect(project.team.max_member_access(maintainer.id)).to eq(Gitlab::Access::DEVELOPER) } it { expect(project.team.max_member_access(reporter.id)).to eq(Gitlab::Access::REPORTER) } it { expect(project.team.max_member_access(nonmember.id)).to eq(Gitlab::Access::NO_ACCESS) } it { expect(project.team.max_member_access(requester.id)).to eq(Gitlab::Access::NO_ACCESS) } @@ -244,7 +244,7 @@ describe ProjectTeam do project.namespace.update(share_with_group_lock: true) end - it { expect(project.team.max_member_access(master.id)).to eq(Gitlab::Access::NO_ACCESS) } + it { expect(project.team.max_member_access(maintainer.id)).to eq(Gitlab::Access::NO_ACCESS) } it { expect(project.team.max_member_access(reporter.id)).to eq(Gitlab::Access::NO_ACCESS) } end end @@ -257,13 +257,13 @@ describe ProjectTeam do end before do - group.add_master(master) + group.add_maintainer(maintainer) group.add_reporter(reporter) group.add_guest(guest) group.request_access(requester) end - it { expect(project.team.max_member_access(master.id)).to eq(Gitlab::Access::MASTER) } + it { expect(project.team.max_member_access(maintainer.id)).to eq(Gitlab::Access::MAINTAINER) } it { expect(project.team.max_member_access(reporter.id)).to eq(Gitlab::Access::REPORTER) } it { expect(project.team.max_member_access(guest.id)).to eq(Gitlab::Access::GUEST) } it { expect(project.team.max_member_access(nonmember.id)).to eq(Gitlab::Access::NO_ACCESS) } @@ -274,7 +274,7 @@ describe ProjectTeam do describe '#member?' do let(:group) { create(:group) } let(:developer) { create(:user) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:personal_project) do create(:project, namespace: developer.namespace) @@ -288,11 +288,11 @@ describe ProjectTeam do let(:shared_project) { create(:project) } before do - group.add_master(master) + group.add_maintainer(maintainer) group.add_developer(developer) members_project.add_developer(developer) - members_project.add_master(master) + members_project.add_maintainer(maintainer) create(:project_group_link, project: shared_project, group: group) end @@ -318,14 +318,14 @@ describe ProjectTeam do end it 'checks for the correct minimum level access' do - expect(group_project.team.member?(developer, Gitlab::Access::MASTER)).to be(false) - expect(group_project.team.member?(master, Gitlab::Access::MASTER)).to be(true) - expect(members_project.team.member?(developer, Gitlab::Access::MASTER)).to be(false) - expect(members_project.team.member?(master, Gitlab::Access::MASTER)).to be(true) - expect(shared_project.team.member?(developer, Gitlab::Access::MASTER)).to be(false) - expect(shared_project.team.member?(master, Gitlab::Access::MASTER)).to be(false) + expect(group_project.team.member?(developer, Gitlab::Access::MAINTAINER)).to be(false) + expect(group_project.team.member?(maintainer, Gitlab::Access::MAINTAINER)).to be(true) + expect(members_project.team.member?(developer, Gitlab::Access::MAINTAINER)).to be(false) + expect(members_project.team.member?(maintainer, Gitlab::Access::MAINTAINER)).to be(true) + expect(shared_project.team.member?(developer, Gitlab::Access::MAINTAINER)).to be(false) + expect(shared_project.team.member?(maintainer, Gitlab::Access::MAINTAINER)).to be(false) expect(shared_project.team.member?(developer, Gitlab::Access::DEVELOPER)).to be(true) - expect(shared_project.team.member?(master, Gitlab::Access::DEVELOPER)).to be(true) + expect(shared_project.team.member?(maintainer, Gitlab::Access::DEVELOPER)).to be(true) end end @@ -334,7 +334,7 @@ describe ProjectTeam do let(:group) { create(:group) } let(:second_group) { create(:group) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:reporter) { create(:user) } let(:guest) { create(:user) } @@ -347,23 +347,23 @@ describe ProjectTeam do let(:second_user_without_access) { create(:user) } let(:users) do - [master, reporter, promoted_guest, guest, group_developer, second_developer, user_without_access].map(&:id) + [maintainer, reporter, promoted_guest, guest, group_developer, second_developer, user_without_access].map(&:id) end let(:expected) do { - master.id => Gitlab::Access::MASTER, + maintainer.id => Gitlab::Access::MAINTAINER, reporter.id => Gitlab::Access::REPORTER, promoted_guest.id => Gitlab::Access::DEVELOPER, guest.id => Gitlab::Access::GUEST, group_developer.id => Gitlab::Access::DEVELOPER, - second_developer.id => Gitlab::Access::MASTER, + second_developer.id => Gitlab::Access::MAINTAINER, user_without_access.id => Gitlab::Access::NO_ACCESS } end before do - project.add_master(master) + project.add_maintainer(maintainer) project.add_reporter(reporter) project.add_guest(promoted_guest) project.add_guest(guest) @@ -373,16 +373,16 @@ describe ProjectTeam do group_access: Gitlab::Access::DEVELOPER ) - group.add_master(promoted_guest) + group.add_maintainer(promoted_guest) group.add_developer(group_developer) group.add_developer(second_developer) project.project_group_links.create( group: second_group, - group_access: Gitlab::Access::MASTER + group_access: Gitlab::Access::MAINTAINER ) - second_group.add_master(second_developer) + second_group.add_maintainer(second_developer) end it 'returns correct roles for different users' do diff --git a/spec/models/protected_branch/merge_access_level_spec.rb b/spec/models/protected_branch/merge_access_level_spec.rb index f70503eadbc..612e4a0e332 100644 --- a/spec/models/protected_branch/merge_access_level_spec.rb +++ b/spec/models/protected_branch/merge_access_level_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' describe ProtectedBranch::MergeAccessLevel do - it { is_expected.to validate_inclusion_of(:access_level).in_array([Gitlab::Access::MASTER, Gitlab::Access::DEVELOPER, Gitlab::Access::NO_ACCESS]) } + it { is_expected.to validate_inclusion_of(:access_level).in_array([Gitlab::Access::MAINTAINER, Gitlab::Access::DEVELOPER, Gitlab::Access::NO_ACCESS]) } end diff --git a/spec/models/protected_branch/push_access_level_spec.rb b/spec/models/protected_branch/push_access_level_spec.rb index f161f345761..9ccdc22fd41 100644 --- a/spec/models/protected_branch/push_access_level_spec.rb +++ b/spec/models/protected_branch/push_access_level_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' describe ProtectedBranch::PushAccessLevel do - it { is_expected.to validate_inclusion_of(:access_level).in_array([Gitlab::Access::MASTER, Gitlab::Access::DEVELOPER, Gitlab::Access::NO_ACCESS]) } + it { is_expected.to validate_inclusion_of(:access_level).in_array([Gitlab::Access::MAINTAINER, Gitlab::Access::DEVELOPER, Gitlab::Access::NO_ACCESS]) } end diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index d060ab923d1..caf5d829d21 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -431,6 +431,18 @@ describe Repository do it { is_expected.to be_falsey } end + + context 'non merged branch' do + subject { repository.merged_to_root_ref?('fix') } + + it { is_expected.to be_falsey } + end + + context 'non existent branch' do + subject { repository.merged_to_root_ref?('non_existent_branch') } + + it { is_expected.to be_nil } + end end describe '#can_be_merged?' do @@ -452,17 +464,11 @@ describe Repository do it { is_expected.to be_falsey } end - context 'non merged branch' do - subject { repository.merged_to_root_ref?('fix') } + context 'submodule changes that confuse rugged' do + subject { repository.can_be_merged?('update-gitlab-shell-v-6-0-1', 'update-gitlab-shell-v-6-0-3') } it { is_expected.to be_falsey } end - - context 'non existent branch' do - subject { repository.merged_to_root_ref?('non_existent_branch') } - - it { is_expected.to be_nil } - end end describe '#commit' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6d7b733dd4f..fc46551c3be 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -700,7 +700,7 @@ describe User do @project = create(:project, namespace: @user.namespace) @project_2 = create(:project, group: create(:group)) do |project| - project.add_master(@user) + project.add_maintainer(@user) end @project_3 = create(:project, group: create(:group)) do |project| project.add_developer(@user) @@ -836,7 +836,7 @@ describe User do before do # add user to project - project.add_master(user) + project.add_maintainer(user) # create invite to projet create(:project_member, :developer, project: project, invite_token: '1234', invite_email: 'inviteduser1@example.com') @@ -1581,8 +1581,8 @@ describe User do let!(:merge_event) { create(:event, :created, project: project3, target: merge_request, author: subject) } before do - project1.add_master(subject) - project2.add_master(subject) + project1.add_maintainer(subject) + project2.add_maintainer(subject) end it "includes IDs for projects the user has pushed to" do @@ -1663,8 +1663,8 @@ describe User do let!(:project) { create(:project, group: project_group) } before do - private_group.add_user(user, Gitlab::Access::MASTER) - project.add_master(user) + private_group.add_user(user, Gitlab::Access::MAINTAINER) + project.add_maintainer(user) end subject { user.authorized_groups } @@ -1678,7 +1678,7 @@ describe User do let!(:child_group) { create(:group, parent: parent_group) } before do - parent_group.add_user(user, Gitlab::Access::MASTER) + parent_group.add_user(user, Gitlab::Access::MAINTAINER) end subject { user.membership_groups } @@ -1696,7 +1696,7 @@ describe User do it 'includes projects that belong to a user, but no other projects' do owned = create(:project, :private, namespace: user.namespace) - member = create(:project, :private).tap { |p| p.add_master(user) } + member = create(:project, :private).tap { |p| p.add_maintainer(user) } other = create(:project) expect(subject).to include(owned) @@ -1726,11 +1726,11 @@ describe User do .to contain_exactly(project) end - it 'includes projects for which the user is a master' do + it 'includes projects for which the user is a maintainer' do user = create(:user) project = create(:project, :private) - project.add_master(user) + project.add_maintainer(user) expect(user.authorized_projects(Gitlab::Access::REPORTER)) .to contain_exactly(project) @@ -1824,10 +1824,10 @@ describe User do it 'includes projects for which the user access level is above or equal to reporter' do reporter_project = create(:project) { |p| p.add_reporter(user) } developer_project = create(:project) { |p| p.add_developer(user) } - master_project = create(:project) { |p| p.add_master(user) } + maintainer_project = create(:project) { |p| p.add_maintainer(user) } - expect(user.projects_where_can_admin_issues.to_a).to match_array([master_project, developer_project, reporter_project]) - expect(user.can?(:admin_issue, master_project)).to eq(true) + expect(user.projects_where_can_admin_issues.to_a).to match_array([maintainer_project, developer_project, reporter_project]) + expect(user.can?(:admin_issue, maintainer_project)).to eq(true) expect(user.can?(:admin_issue, developer_project)).to eq(true) expect(user.can?(:admin_issue, reporter_project)).to eq(true) end @@ -1907,9 +1907,9 @@ describe User do end shared_examples :member do - context 'when the user is a master' do + context 'when the user is a maintainer' do before do - add_user(:master) + add_user(:maintainer) end it 'loads' do @@ -2668,20 +2668,20 @@ describe User do let(:user) { create(:user) } let(:group) { create(:group) } let(:owner_project) { create(:project, group: group) } - let(:master_project) { create(:project) } + let(:maintainer_project) { create(:project) } let(:reporter_project) { create(:project) } let(:developer_project) { create(:project) } let(:guest_project) { create(:project) } let(:no_access_project) { create(:project) } let(:projects) do - [owner_project, master_project, reporter_project, developer_project, guest_project, no_access_project].map(&:id) + [owner_project, maintainer_project, reporter_project, developer_project, guest_project, no_access_project].map(&:id) end let(:expected) do { owner_project.id => Gitlab::Access::OWNER, - master_project.id => Gitlab::Access::MASTER, + maintainer_project.id => Gitlab::Access::MAINTAINER, reporter_project.id => Gitlab::Access::REPORTER, developer_project.id => Gitlab::Access::DEVELOPER, guest_project.id => Gitlab::Access::GUEST, @@ -2691,7 +2691,7 @@ describe User do before do create(:group_member, user: user, group: group) - master_project.add_master(user) + maintainer_project.add_maintainer(user) reporter_project.add_reporter(user) developer_project.add_developer(user) guest_project.add_guest(user) @@ -2718,14 +2718,14 @@ describe User do end it 'only requests the extra projects when uncached projects are passed' do - second_master_project = create(:project) + second_maintainer_project = create(:project) second_developer_project = create(:project) - second_master_project.add_master(user) + second_maintainer_project.add_maintainer(user) second_developer_project.add_developer(user) - all_projects = projects + [second_master_project.id, second_developer_project.id] + all_projects = projects + [second_maintainer_project.id, second_developer_project.id] - expected_all = expected.merge(second_master_project.id => Gitlab::Access::MASTER, + expected_all = expected.merge(second_maintainer_project.id => Gitlab::Access::MAINTAINER, second_developer_project.id => Gitlab::Access::DEVELOPER) access_levels(projects) @@ -2733,7 +2733,7 @@ describe User do queries = ActiveRecord::QueryRecorder.new { access_levels(all_projects) } expect(queries.count).to eq(1) - expect(queries.log_message).to match(/\W(#{second_master_project.id}, #{second_developer_project.id})\W/) + expect(queries.log_message).to match(/\W(#{second_maintainer_project.id}, #{second_developer_project.id})\W/) expect(access_levels(all_projects)).to eq(expected_all) end end @@ -2747,20 +2747,20 @@ describe User do shared_examples 'max member access for groups' do let(:user) { create(:user) } let(:owner_group) { create(:group) } - let(:master_group) { create(:group) } + let(:maintainer_group) { create(:group) } let(:reporter_group) { create(:group) } let(:developer_group) { create(:group) } let(:guest_group) { create(:group) } let(:no_access_group) { create(:group) } let(:groups) do - [owner_group, master_group, reporter_group, developer_group, guest_group, no_access_group].map(&:id) + [owner_group, maintainer_group, reporter_group, developer_group, guest_group, no_access_group].map(&:id) end let(:expected) do { owner_group.id => Gitlab::Access::OWNER, - master_group.id => Gitlab::Access::MASTER, + maintainer_group.id => Gitlab::Access::MAINTAINER, reporter_group.id => Gitlab::Access::REPORTER, developer_group.id => Gitlab::Access::DEVELOPER, guest_group.id => Gitlab::Access::GUEST, @@ -2770,7 +2770,7 @@ describe User do before do owner_group.add_owner(user) - master_group.add_master(user) + maintainer_group.add_maintainer(user) reporter_group.add_reporter(user) developer_group.add_developer(user) guest_group.add_guest(user) @@ -2797,14 +2797,14 @@ describe User do end it 'only requests the extra groups when uncached groups are passed' do - second_master_group = create(:group) + second_maintainer_group = create(:group) second_developer_group = create(:group) - second_master_group.add_master(user) + second_maintainer_group.add_maintainer(user) second_developer_group.add_developer(user) - all_groups = groups + [second_master_group.id, second_developer_group.id] + all_groups = groups + [second_maintainer_group.id, second_developer_group.id] - expected_all = expected.merge(second_master_group.id => Gitlab::Access::MASTER, + expected_all = expected.merge(second_maintainer_group.id => Gitlab::Access::MAINTAINER, second_developer_group.id => Gitlab::Access::DEVELOPER) access_levels(groups) @@ -2812,7 +2812,7 @@ describe User do queries = ActiveRecord::QueryRecorder.new { access_levels(all_groups) } expect(queries.count).to eq(1) - expect(queries.log_message).to match(/\W(#{second_master_group.id}, #{second_developer_group.id})\W/) + expect(queries.log_message).to match(/\W(#{second_maintainer_group.id}, #{second_developer_group.id})\W/) expect(access_levels(all_groups)).to eq(expected_all) end end diff --git a/spec/policies/ci/build_policy_spec.rb b/spec/policies/ci/build_policy_spec.rb index eead55d33ca..79a616899fa 100644 --- a/spec/policies/ci/build_policy_spec.rb +++ b/spec/policies/ci/build_policy_spec.rb @@ -204,18 +204,18 @@ describe Ci::BuildPolicy do end end - context 'when a master erases a build' do + context 'when a maintainer erases a build' do before do - project.add_master(user) + project.add_maintainer(user) end - context 'when masters can push to the branch' do + context 'when maintainers can push to the branch' do before do - create(:protected_branch, :masters_can_push, + create(:protected_branch, :maintainers_can_push, name: build.ref, project: project) end - context 'when the build was created by the master' do + context 'when the build was created by the maintainer' do let(:owner) { user } it { expect(policy).to be_allowed :erase_build } diff --git a/spec/policies/ci/pipeline_schedule_policy_spec.rb b/spec/policies/ci/pipeline_schedule_policy_spec.rb index c0c3eda4911..f1d3cd04e32 100644 --- a/spec/policies/ci/pipeline_schedule_policy_spec.rb +++ b/spec/policies/ci/pipeline_schedule_policy_spec.rb @@ -77,9 +77,9 @@ describe Ci::PipelineSchedulePolicy, :models do end end - describe 'rules for a master' do + describe 'rules for a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it 'includes abilities to do do all operations on pipeline schedule' do @@ -93,8 +93,8 @@ describe Ci::PipelineSchedulePolicy, :models do let(:owner) { create(:user) } before do - project.add_master(owner) - project.add_master(user) + project.add_maintainer(owner) + project.add_maintainer(user) pipeline_schedule.update(owner: owner) end diff --git a/spec/policies/ci/trigger_policy_spec.rb b/spec/policies/ci/trigger_policy_spec.rb index 14630748c90..d8a63066265 100644 --- a/spec/policies/ci/trigger_policy_spec.rb +++ b/spec/policies/ci/trigger_policy_spec.rb @@ -43,9 +43,9 @@ describe Ci::TriggerPolicy do context 'when owner is undefined' do let(:owner) { nil } - context 'when user is master of the project' do + context 'when user is maintainer of the project' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'allows to admin and manage trigger' @@ -67,9 +67,9 @@ describe Ci::TriggerPolicy do context 'when owner is an user' do let(:owner) { user } - context 'when user is master of the project' do + context 'when user is maintainer of the project' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'allows to admin and manage trigger' @@ -79,9 +79,9 @@ describe Ci::TriggerPolicy do context 'when owner is another user' do let(:owner) { create(:user) } - context 'when user is master of the project' do + context 'when user is maintainer of the project' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'allows to manage trigger' diff --git a/spec/policies/clusters/cluster_policy_spec.rb b/spec/policies/clusters/cluster_policy_spec.rb index 4207f42b07f..ced969830d8 100644 --- a/spec/policies/clusters/cluster_policy_spec.rb +++ b/spec/policies/clusters/cluster_policy_spec.rb @@ -16,9 +16,9 @@ describe Clusters::ClusterPolicy, :models do it { expect(policy).to be_disallowed :admin_cluster } end - context 'when master' do + context 'when maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it { expect(policy).to be_allowed :update_cluster } diff --git a/spec/policies/deploy_key_policy_spec.rb b/spec/policies/deploy_key_policy_spec.rb index ca7b7fe7ef7..e7263d49613 100644 --- a/spec/policies/deploy_key_policy_spec.rb +++ b/spec/policies/deploy_key_policy_spec.rb @@ -12,7 +12,7 @@ describe DeployKeyPolicy do let(:project) { create(:project_empty_repo) } before do - project.add_master(current_user) + project.add_maintainer(current_user) project.deploy_keys << deploy_key end diff --git a/spec/policies/deploy_token_policy_spec.rb b/spec/policies/deploy_token_policy_spec.rb index eea287d895e..cef5a4a22bc 100644 --- a/spec/policies/deploy_token_policy_spec.rb +++ b/spec/policies/deploy_token_policy_spec.rb @@ -8,15 +8,15 @@ describe DeployTokenPolicy do subject { described_class.new(current_user, deploy_token) } describe 'creating a deploy key' do - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(current_user) + project.add_maintainer(current_user) end it { is_expected.to be_allowed(:create_deploy_token) } end - context 'when user is not master' do + context 'when user is not maintainer' do before do project.add_developer(current_user) end @@ -26,15 +26,15 @@ describe DeployTokenPolicy do end describe 'updating a deploy key' do - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(current_user) + project.add_maintainer(current_user) end it { is_expected.to be_allowed(:update_deploy_token) } end - context 'when user is not master' do + context 'when user is not maintainer' do before do project.add_developer(current_user) end diff --git a/spec/policies/environment_policy_spec.rb b/spec/policies/environment_policy_spec.rb index de4cb5b30c5..0442b032e89 100644 --- a/spec/policies/environment_policy_spec.rb +++ b/spec/policies/environment_policy_spec.rb @@ -1,57 +1,101 @@ require 'spec_helper' describe EnvironmentPolicy do - let(:user) { create(:user) } - let(:project) { create(:project, :repository) } + using RSpec::Parameterized::TableSyntax - let(:environment) do - create(:environment, :with_review_app, project: project) - end + let(:user) { create(:user) } let(:policy) do described_class.new(user, environment) end describe '#rules' do - context 'when user does not have access to the project' do - let(:project) { create(:project, :private, :repository) } + shared_examples 'project permissions' do + context 'with stop action' do + let(:environment) do + create(:environment, :with_review_app, project: project) + end - it 'does not include ability to stop environment' do - expect(policy).to be_disallowed :stop_environment - end - end + where(:access_level, :allowed?) do + nil | false + :guest | false + :reporter | false + :developer | true + :maintainer | true + end - context 'when anonymous user has access to the project' do - let(:project) { create(:project, :public, :repository) } + with_them do + before do + project.add_user(user, access_level) unless access_level.nil? + end - it 'does not include ability to stop environment' do - expect(policy).to be_disallowed :stop_environment - end - end + it { expect(policy.allowed?(:stop_environment)).to be allowed? } + end - context 'when team member has access to the project' do - let(:project) { create(:project, :public, :repository) } + context 'when an admin user' do + let(:user) { create(:user, :admin) } - before do - project.add_developer(user) - end + it { expect(policy).to be_allowed :stop_environment } + end + + context 'with protected branch' do + with_them do + before do + project.add_user(user, access_level) unless access_level.nil? + create(:protected_branch, :no_one_can_push, + name: 'master', project: project) + end - context 'when team member has ability to stop environment' do - it 'does includes ability to stop environment' do - expect(policy).to be_allowed :stop_environment + it { expect(policy).to be_disallowed :stop_environment } + end + + context 'when an admin user' do + let(:user) { create(:user, :admin) } + + it { expect(policy).to be_allowed :stop_environment } + end end end - context 'when team member has no ability to stop environment' do - before do - create(:protected_branch, :no_one_can_push, - name: 'master', project: project) + context 'without stop action' do + let(:environment) do + create(:environment, project: project) + end + + where(:access_level, :allowed?) do + nil | false + :guest | false + :reporter | false + :developer | false + :maintainer | true end - it 'does not include ability to stop environment' do - expect(policy).to be_disallowed :stop_environment + with_them do + before do + project.add_user(user, access_level) unless access_level.nil? + end + + it { expect(policy.allowed?(:stop_environment)).to be allowed? } + end + + context 'when an admin user' do + let(:user) { create(:user, :admin) } + + it { expect(policy).to be_allowed :stop_environment } end end end + + context 'when project is public' do + let(:project) { create(:project, :public, :repository) } + + include_examples 'project permissions' + end + + context 'when project is private' do + let(:project) { create(:project, :private, :repository) } + + include_examples 'project permissions' + end end end diff --git a/spec/policies/global_policy_spec.rb b/spec/policies/global_policy_spec.rb index 873673b50ef..a2047b54deb 100644 --- a/spec/policies/global_policy_spec.rb +++ b/spec/policies/global_policy_spec.rb @@ -65,12 +65,12 @@ describe GlobalPolicy do it { is_expected.not_to be_allowed(:create_fork) } end - context "when user is a master in a group" do + context "when user is a maintainer in a group" do let(:group) { create(:group) } let(:current_user) { create(:user, projects_limit: 0) } before do - group.add_master(current_user) + group.add_maintainer(current_user) end it { is_expected.to be_allowed(:create_fork) } diff --git a/spec/policies/group_policy_spec.rb b/spec/policies/group_policy_spec.rb index d6d340bd806..35951251bc5 100644 --- a/spec/policies/group_policy_spec.rb +++ b/spec/policies/group_policy_spec.rb @@ -4,7 +4,7 @@ describe GroupPolicy do let(:guest) { create(:user) } let(:reporter) { create(:user) } let(:developer) { create(:user) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:owner) { create(:user) } let(:admin) { create(:admin) } let(:group) { create(:group, :private) } @@ -19,7 +19,7 @@ describe GroupPolicy do let(:developer_permissions) { [:admin_milestones] } - let(:master_permissions) do + let(:maintainer_permissions) do [ :create_projects ] @@ -39,7 +39,7 @@ describe GroupPolicy do group.add_guest(guest) group.add_reporter(reporter) group.add_developer(developer) - group.add_master(master) + group.add_maintainer(maintainer) group.add_owner(owner) end @@ -62,7 +62,7 @@ describe GroupPolicy do expect_disallowed(:upload_file) expect_disallowed(*reporter_permissions) expect_disallowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) expect_disallowed(:read_namespace) end @@ -97,7 +97,7 @@ describe GroupPolicy do expect_allowed(*guest_permissions) expect_disallowed(*reporter_permissions) expect_disallowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end end @@ -109,7 +109,7 @@ describe GroupPolicy do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_disallowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end end @@ -121,19 +121,19 @@ describe GroupPolicy do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_allowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end end - context 'master' do - let(:current_user) { master } + context 'maintainer' do + let(:current_user) { maintainer } it do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_allowed(*developer_permissions) - expect_allowed(*master_permissions) + expect_allowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end end @@ -147,7 +147,7 @@ describe GroupPolicy do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_allowed(*developer_permissions) - expect_allowed(*master_permissions) + expect_allowed(*maintainer_permissions) expect_allowed(*owner_permissions) end end @@ -161,7 +161,7 @@ describe GroupPolicy do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_allowed(*developer_permissions) - expect_allowed(*master_permissions) + expect_allowed(*maintainer_permissions) expect_allowed(*owner_permissions) end end @@ -203,7 +203,7 @@ describe GroupPolicy do nested_group.add_guest(guest) nested_group.add_guest(reporter) nested_group.add_guest(developer) - nested_group.add_guest(master) + nested_group.add_guest(maintainer) group.owners.destroy_all @@ -220,7 +220,7 @@ describe GroupPolicy do expect_disallowed(*guest_permissions) expect_disallowed(*reporter_permissions) expect_disallowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end end @@ -232,7 +232,7 @@ describe GroupPolicy do expect_allowed(*guest_permissions) expect_disallowed(*reporter_permissions) expect_disallowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end end @@ -244,7 +244,7 @@ describe GroupPolicy do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_disallowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end end @@ -256,19 +256,19 @@ describe GroupPolicy do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_allowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end end - context 'master' do - let(:current_user) { master } + context 'maintainer' do + let(:current_user) { maintainer } it do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_allowed(*developer_permissions) - expect_allowed(*master_permissions) + expect_allowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end end @@ -282,7 +282,7 @@ describe GroupPolicy do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_allowed(*developer_permissions) - expect_allowed(*master_permissions) + expect_allowed(*maintainer_permissions) expect_allowed(*owner_permissions) end end diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb index 6d4676c25a5..dd3fa4e6a51 100644 --- a/spec/policies/project_policy_spec.rb +++ b/spec/policies/project_policy_spec.rb @@ -4,7 +4,7 @@ describe ProjectPolicy do set(:guest) { create(:user) } set(:reporter) { create(:user) } set(:developer) { create(:user) } - set(:master) { create(:user) } + set(:maintainer) { create(:user) } set(:owner) { create(:user) } set(:admin) { create(:admin) } let(:project) { create(:project, :public, namespace: owner.namespace) } @@ -42,7 +42,7 @@ describe ProjectPolicy do ] end - let(:base_master_permissions) do + let(:base_maintainer_permissions) do %i[ push_to_delete_protected_branch update_project_snippet update_environment update_deployment admin_project_snippet @@ -70,15 +70,15 @@ describe ProjectPolicy do # Used in EE specs let(:additional_guest_permissions) { [] } let(:additional_reporter_permissions) { [] } - let(:additional_master_permissions) { [] } + let(:additional_maintainer_permissions) { [] } let(:guest_permissions) { base_guest_permissions + additional_guest_permissions } let(:reporter_permissions) { base_reporter_permissions + additional_reporter_permissions } - let(:master_permissions) { base_master_permissions + additional_master_permissions } + let(:maintainer_permissions) { base_maintainer_permissions + additional_maintainer_permissions } before do project.add_guest(guest) - project.add_master(master) + project.add_maintainer(maintainer) project.add_developer(developer) project.add_reporter(reporter) end @@ -276,7 +276,7 @@ describe ProjectPolicy do expect_disallowed(*reporter_public_build_permissions) expect_disallowed(*team_member_reporter_permissions) expect_disallowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end @@ -326,7 +326,7 @@ describe ProjectPolicy do expect_allowed(*reporter_permissions) expect_allowed(*team_member_reporter_permissions) expect_disallowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end @@ -347,7 +347,7 @@ describe ProjectPolicy do expect_allowed(*reporter_permissions) expect_allowed(*team_member_reporter_permissions) expect_allowed(*developer_permissions) - expect_disallowed(*master_permissions) + expect_disallowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end @@ -357,23 +357,23 @@ describe ProjectPolicy do end end - shared_examples 'project policies as master' do + shared_examples 'project policies as maintainer' do context 'abilities for non-public projects' do let(:project) { create(:project, namespace: owner.namespace) } - subject { described_class.new(master, project) } + subject { described_class.new(maintainer, project) } it do expect_allowed(*guest_permissions) expect_allowed(*reporter_permissions) expect_allowed(*team_member_reporter_permissions) expect_allowed(*developer_permissions) - expect_allowed(*master_permissions) + expect_allowed(*maintainer_permissions) expect_disallowed(*owner_permissions) end it_behaves_like 'archived project policies' do - let(:regular_abilities) { master_permissions } + let(:regular_abilities) { maintainer_permissions } end end end @@ -389,7 +389,7 @@ describe ProjectPolicy do expect_allowed(*reporter_permissions) expect_allowed(*team_member_reporter_permissions) expect_allowed(*developer_permissions) - expect_allowed(*master_permissions) + expect_allowed(*maintainer_permissions) expect_allowed(*owner_permissions) end @@ -410,7 +410,7 @@ describe ProjectPolicy do expect_allowed(*reporter_permissions) expect_disallowed(*team_member_reporter_permissions) expect_allowed(*developer_permissions) - expect_allowed(*master_permissions) + expect_allowed(*maintainer_permissions) expect_allowed(*owner_permissions) end @@ -424,7 +424,7 @@ describe ProjectPolicy do it_behaves_like 'project policies as guest' it_behaves_like 'project policies as reporter' it_behaves_like 'project policies as developer' - it_behaves_like 'project policies as master' + it_behaves_like 'project policies as maintainer' it_behaves_like 'project policies as owner' it_behaves_like 'project policies as admin' diff --git a/spec/policies/protected_branch_policy_spec.rb b/spec/policies/protected_branch_policy_spec.rb index b39de42d721..1587196754d 100644 --- a/spec/policies/protected_branch_policy_spec.rb +++ b/spec/policies/protected_branch_policy_spec.rb @@ -8,8 +8,8 @@ describe ProtectedBranchPolicy do subject { described_class.new(user, protected_branch) } - it 'branches can be updated via project masters' do - project.add_master(user) + it 'branches can be updated via project maintainers' do + project.add_maintainer(user) is_expected.to be_allowed(:update_protected_branch) end diff --git a/spec/presenters/merge_request_presenter_spec.rb b/spec/presenters/merge_request_presenter_spec.rb index e3b37739e8e..46ba6f442f5 100644 --- a/spec/presenters/merge_request_presenter_spec.rb +++ b/spec/presenters/merge_request_presenter_spec.rb @@ -270,7 +270,7 @@ describe MergeRequestPresenter do context 'when can create issue and issues enabled' do it 'returns path' do allow(project).to receive(:issues_enabled?) { true } - project.add_master(user) + project.add_maintainer(user) is_expected .to eq("/#{resource.project.full_path}/issues/new?merge_request_to_resolve_discussions_of=#{resource.iid}") @@ -288,7 +288,7 @@ describe MergeRequestPresenter do context 'when issues disabled' do it 'returns nil' do allow(project).to receive(:issues_enabled?) { false } - project.add_master(user) + project.add_maintainer(user) is_expected.to be_nil end @@ -307,7 +307,7 @@ describe MergeRequestPresenter do context 'when merge request enabled and has permission' do it 'has remove_wip_path' do allow(project).to receive(:merge_requests_enabled?) { true } - project.add_master(user) + project.add_maintainer(user) is_expected .to eq("/#{resource.project.full_path}/merge_requests/#{resource.iid}/remove_wip") diff --git a/spec/presenters/project_presenter_spec.rb b/spec/presenters/project_presenter_spec.rb index 830d2ee3b20..01085dbcb49 100644 --- a/spec/presenters/project_presenter_spec.rb +++ b/spec/presenters/project_presenter_spec.rb @@ -326,7 +326,7 @@ describe ProjectPresenter do context 'when user can admin pipeline and CI yml does not exists' do it 'returns anchor data' do - project.add_master(user) + project.add_maintainer(user) allow(project).to receive(:auto_devops_enabled?).and_return(false) allow(project.repository).to receive(:gitlab_ci_yml).and_return(nil) @@ -340,7 +340,7 @@ describe ProjectPresenter do describe '#kubernetes_cluster_anchor_data' do context 'when user can create Kubernetes cluster' do it 'returns link to cluster if only one exists' do - project.add_master(user) + project.add_maintainer(user) cluster = create(:cluster, projects: [project]) expect(presenter.kubernetes_cluster_anchor_data).to eq(OpenStruct.new(enabled: true, @@ -349,7 +349,7 @@ describe ProjectPresenter do end it 'returns link to clusters page if more than one exists' do - project.add_master(user) + project.add_maintainer(user) create(:cluster, :production_environment, projects: [project]) create(:cluster, projects: [project]) @@ -359,7 +359,7 @@ describe ProjectPresenter do end it 'returns link to create a cluster if no cluster exists' do - project.add_master(user) + project.add_maintainer(user) expect(presenter.kubernetes_cluster_anchor_data).to eq(OpenStruct.new(enabled: false, label: 'Add Kubernetes cluster', diff --git a/spec/requests/api/access_requests_spec.rb b/spec/requests/api/access_requests_spec.rb index ffca7ab8e45..e13129967b2 100644 --- a/spec/requests/api/access_requests_spec.rb +++ b/spec/requests/api/access_requests_spec.rb @@ -1,15 +1,15 @@ require 'spec_helper' describe API::AccessRequests do - set(:master) { create(:user) } + set(:maintainer) { create(:user) } set(:developer) { create(:user) } set(:access_requester) { create(:user) } set(:stranger) { create(:user) } set(:project) do - create(:project, :public, :access_requestable, creator_id: master.id, namespace: master.namespace) do |project| + create(:project, :public, :access_requestable, creator_id: maintainer.id, namespace: maintainer.namespace) do |project| project.add_developer(developer) - project.add_master(master) + project.add_maintainer(maintainer) project.request_access(access_requester) end end @@ -17,7 +17,7 @@ describe API::AccessRequests do set(:group) do create(:group, :public, :access_requestable) do |group| group.add_developer(developer) - group.add_owner(master) + group.add_owner(maintainer) group.request_access(access_requester) end end @@ -28,7 +28,7 @@ describe API::AccessRequests do let(:route) { get api("/#{source_type.pluralize}/#{source.id}/access_requests", stranger) } end - context 'when authenticated as a non-master/owner' do + context 'when authenticated as a non-maintainer/owner' do %i[developer access_requester stranger].each do |type| context "as a #{type}" do it 'returns 403' do @@ -41,9 +41,9 @@ describe API::AccessRequests do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do it 'returns access requesters' do - get api("/#{source_type.pluralize}/#{source.id}/access_requests", master) + get api("/#{source_type.pluralize}/#{source.id}/access_requests", maintainer) expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers @@ -61,7 +61,7 @@ describe API::AccessRequests do end context 'when authenticated as a member' do - %i[developer master].each do |type| + %i[developer maintainer].each do |type| context "as a #{type}" do it 'returns 403' do expect do @@ -128,7 +128,7 @@ describe API::AccessRequests do let(:route) { put api("/#{source_type.pluralize}/#{source.id}/access_requests/#{access_requester.id}/approve", stranger) } end - context 'when authenticated as a non-master/owner' do + context 'when authenticated as a non-maintainer/owner' do %i[developer access_requester stranger].each do |type| context "as a #{type}" do it 'returns 403' do @@ -141,11 +141,11 @@ describe API::AccessRequests do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do it 'returns 201' do expect do - put api("/#{source_type.pluralize}/#{source.id}/access_requests/#{access_requester.id}/approve", master), - access_level: Member::MASTER + put api("/#{source_type.pluralize}/#{source.id}/access_requests/#{access_requester.id}/approve", maintainer), + access_level: Member::MAINTAINER expect(response).to have_gitlab_http_status(201) end.to change { source.members.count }.by(1) @@ -158,13 +158,13 @@ describe API::AccessRequests do expect(json_response['web_url']).to eq(Gitlab::Routing.url_helpers.user_url(access_requester)) # Member attributes - expect(json_response['access_level']).to eq(Member::MASTER) + expect(json_response['access_level']).to eq(Member::MAINTAINER) end context 'user_id does not match an existing access requester' do it 'returns 404' do expect do - put api("/#{source_type.pluralize}/#{source.id}/access_requests/#{stranger.id}/approve", master) + put api("/#{source_type.pluralize}/#{source.id}/access_requests/#{stranger.id}/approve", maintainer) expect(response).to have_gitlab_http_status(404) end.not_to change { source.members.count } @@ -180,7 +180,7 @@ describe API::AccessRequests do let(:route) { delete api("/#{source_type.pluralize}/#{source.id}/access_requests/#{access_requester.id}", stranger) } end - context 'when authenticated as a non-master/owner' do + context 'when authenticated as a non-maintainer/owner' do %i[developer stranger].each do |type| context "as a #{type}" do it 'returns 403' do @@ -203,10 +203,10 @@ describe API::AccessRequests do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do it 'deletes the access requester' do expect do - delete api("/#{source_type.pluralize}/#{source.id}/access_requests/#{access_requester.id}", master) + delete api("/#{source_type.pluralize}/#{source.id}/access_requests/#{access_requester.id}", maintainer) expect(response).to have_gitlab_http_status(204) end.to change { source.requesters.count }.by(-1) @@ -215,7 +215,7 @@ describe API::AccessRequests do context 'user_id matches a member, not an access requester' do it 'returns 404' do expect do - delete api("/#{source_type.pluralize}/#{source.id}/access_requests/#{developer.id}", master) + delete api("/#{source_type.pluralize}/#{source.id}/access_requests/#{developer.id}", maintainer) expect(response).to have_gitlab_http_status(404) end.not_to change { source.requesters.count } @@ -225,7 +225,7 @@ describe API::AccessRequests do context 'user_id does not match an existing access requester' do it 'returns 404' do expect do - delete api("/#{source_type.pluralize}/#{source.id}/access_requests/#{stranger.id}", master) + delete api("/#{source_type.pluralize}/#{source.id}/access_requests/#{stranger.id}", maintainer) expect(response).to have_gitlab_http_status(404) end.not_to change { source.requesters.count } diff --git a/spec/requests/api/award_emoji_spec.rb b/spec/requests/api/award_emoji_spec.rb index 5adfb33677f..0921fecb933 100644 --- a/spec/requests/api/award_emoji_spec.rb +++ b/spec/requests/api/award_emoji_spec.rb @@ -10,7 +10,7 @@ describe API::AwardEmoji do set(:note) { create(:note, project: project, noteable: issue) } before do - project.add_master(user) + project.add_maintainer(user) end describe "GET /projects/:id/awardable/:awardable_id/award_emoji" do diff --git a/spec/requests/api/badges_spec.rb b/spec/requests/api/badges_spec.rb index ae64a9ca162..e232e2e04ee 100644 --- a/spec/requests/api/badges_spec.rb +++ b/spec/requests/api/badges_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe API::Badges do - let(:master) { create(:user, username: 'master_user') } + let(:maintainer) { create(:user, username: 'maintainer_user') } let(:developer) { create(:user) } let(:access_requester) { create(:user) } let(:stranger) { create(:user) } @@ -25,7 +25,7 @@ describe API::Badges do let(:route) { get api("/#{source_type.pluralize}/#{source.id}/badges", stranger) } end - %i[master developer access_requester stranger].each do |type| + %i[maintainer developer access_requester stranger].each do |type| context "when authenticated as a #{type}" do it 'returns 200' do user = public_send(type) @@ -43,16 +43,16 @@ describe API::Badges do it 'avoids N+1 queries' do # Establish baseline - get api("/#{source_type.pluralize}/#{source.id}/badges", master) + get api("/#{source_type.pluralize}/#{source.id}/badges", maintainer) control = ActiveRecord::QueryRecorder.new do - get api("/#{source_type.pluralize}/#{source.id}/badges", master) + get api("/#{source_type.pluralize}/#{source.id}/badges", maintainer) end project.add_developer(create(:user)) expect do - get api("/#{source_type.pluralize}/#{source.id}/badges", master) + get api("/#{source_type.pluralize}/#{source.id}/badges", maintainer) end.not_to exceed_query_limit(control) end end @@ -69,7 +69,7 @@ describe API::Badges do end context 'when authenticated as a non-member' do - %i[master developer access_requester stranger].each do |type| + %i[maintainer developer access_requester stranger].each do |type| let(:badge) { source.badges.first } context "as a #{type}" do @@ -122,10 +122,10 @@ describe API::Badges do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do it 'creates a new badge' do expect do - post api("/#{source_type.pluralize}/#{source.id}/badges", master), + post api("/#{source_type.pluralize}/#{source.id}/badges", maintainer), link_url: example_url, image_url: example_url2 expect(response).to have_gitlab_http_status(201) @@ -138,21 +138,21 @@ describe API::Badges do end it 'returns 400 when link_url is not given' do - post api("/#{source_type.pluralize}/#{source.id}/badges", master), + post api("/#{source_type.pluralize}/#{source.id}/badges", maintainer), link_url: example_url expect(response).to have_gitlab_http_status(400) end it 'returns 400 when image_url is not given' do - post api("/#{source_type.pluralize}/#{source.id}/badges", master), + post api("/#{source_type.pluralize}/#{source.id}/badges", maintainer), image_url: example_url2 expect(response).to have_gitlab_http_status(400) end it 'returns 400 when link_url or image_url is not valid' do - post api("/#{source_type.pluralize}/#{source.id}/badges", master), + post api("/#{source_type.pluralize}/#{source.id}/badges", maintainer), link_url: 'whatever', image_url: 'whatever' expect(response).to have_gitlab_http_status(400) @@ -192,9 +192,9 @@ describe API::Badges do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do it 'updates the member' do - put api("/#{source_type.pluralize}/#{source.id}/badges/#{badge.id}", master), + put api("/#{source_type.pluralize}/#{source.id}/badges/#{badge.id}", maintainer), link_url: example_url, image_url: example_url2 expect(response).to have_gitlab_http_status(200) @@ -205,7 +205,7 @@ describe API::Badges do end it 'returns 400 when link_url or image_url is not valid' do - put api("/#{source_type.pluralize}/#{source.id}/badges/#{badge.id}", master), + put api("/#{source_type.pluralize}/#{source.id}/badges/#{badge.id}", maintainer), link_url: 'whatever', image_url: 'whatever' expect(response).to have_gitlab_http_status(400) @@ -239,22 +239,22 @@ describe API::Badges do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do it 'deletes the badge' do expect do - delete api("/#{source_type.pluralize}/#{source.id}/badges/#{badge.id}", master) + delete api("/#{source_type.pluralize}/#{source.id}/badges/#{badge.id}", maintainer) expect(response).to have_gitlab_http_status(204) end.to change { source.badges.count }.by(-1) end it_behaves_like '412 response' do - let(:request) { api("/#{source_type.pluralize}/#{source.id}/badges/#{badge.id}", master) } + let(:request) { api("/#{source_type.pluralize}/#{source.id}/badges/#{badge.id}", maintainer) } end end it 'returns 404 if badge does not exist' do - delete api("/#{source_type.pluralize}/#{source.id}/badges/123", master) + delete api("/#{source_type.pluralize}/#{source.id}/badges/123", maintainer) expect(response).to have_gitlab_http_status(404) end @@ -289,9 +289,9 @@ describe API::Badges do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do it 'gets the rendered badge values' do - get api("/#{source_type.pluralize}/#{source.id}/badges/render?link_url=#{example_url}&image_url=#{example_url2}", master) + get api("/#{source_type.pluralize}/#{source.id}/badges/render?link_url=#{example_url}&image_url=#{example_url2}", maintainer) expect(response).to have_gitlab_http_status(200) @@ -304,19 +304,19 @@ describe API::Badges do end it 'returns 400 when link_url is not given' do - get api("/#{source_type.pluralize}/#{source.id}/badges/render?link_url=#{example_url}", master) + get api("/#{source_type.pluralize}/#{source.id}/badges/render?link_url=#{example_url}", maintainer) expect(response).to have_gitlab_http_status(400) end it 'returns 400 when image_url is not given' do - get api("/#{source_type.pluralize}/#{source.id}/badges/render?image_url=#{example_url}", master) + get api("/#{source_type.pluralize}/#{source.id}/badges/render?image_url=#{example_url}", maintainer) expect(response).to have_gitlab_http_status(400) end it 'returns 400 when link_url or image_url is not valid' do - get api("/#{source_type.pluralize}/#{source.id}/badges/render?link_url=whatever&image_url=whatever", master) + get api("/#{source_type.pluralize}/#{source.id}/badges/render?link_url=whatever&image_url=whatever", maintainer) expect(response).to have_gitlab_http_status(400) end @@ -326,7 +326,7 @@ describe API::Badges do context 'when deleting a badge' do context 'and the source is a project' do it 'cannot delete badges owned by the project group' do - delete api("/projects/#{project.id}/badges/#{project_group.badges.first.id}", master) + delete api("/projects/#{project.id}/badges/#{project_group.badges.first.id}", maintainer) expect(response).to have_gitlab_http_status(403) end @@ -345,9 +345,9 @@ describe API::Badges do end def setup_project - create(:project, :public, :access_requestable, creator_id: master.id, namespace: project_group) do |project| + create(:project, :public, :access_requestable, creator_id: maintainer.id, namespace: project_group) do |project| project.add_developer(developer) - project.add_master(master) + project.add_maintainer(maintainer) project.request_access(access_requester) project.project_badges << build(:project_badge, project: project) project.project_badges << build(:project_badge, project: project) @@ -358,7 +358,7 @@ describe API::Badges do def setup_group create(:group, :public, :access_requestable) do |group| group.add_developer(developer) - group.add_owner(master) + group.add_owner(maintainer) group.request_access(access_requester) group.badges << build(:group_badge, group: group) group.badges << build(:group_badge, group: group) diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index 9bb6ed62393..7fff0a6cce6 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -13,7 +13,7 @@ describe API::Branches do let(:current_user) { nil } before do - project.add_master(user) + project.add_maintainer(user) end describe "GET /projects/:id/repository/branches" do @@ -75,7 +75,7 @@ describe API::Branches do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'repository branches' @@ -170,7 +170,7 @@ describe API::Branches do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'repository branch' @@ -324,7 +324,7 @@ describe API::Branches do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } context "when a protected branch doesn't already exist" do @@ -381,8 +381,8 @@ describe API::Branches do expect(json_response['protected']).to eq(true) expect(json_response['developers_can_push']).to eq(false) expect(json_response['developers_can_merge']).to eq(false) - expect(protected_branch.reload.push_access_levels.first.access_level).to eq(Gitlab::Access::MASTER) - expect(protected_branch.reload.merge_access_levels.first.access_level).to eq(Gitlab::Access::MASTER) + expect(protected_branch.reload.push_access_levels.first.access_level).to eq(Gitlab::Access::MAINTAINER) + expect(protected_branch.reload.merge_access_levels.first.access_level).to eq(Gitlab::Access::MAINTAINER) end end @@ -458,7 +458,7 @@ describe API::Branches do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } context "when a protected branch doesn't already exist" do @@ -534,7 +534,7 @@ describe API::Branches do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } context "when a protected branch doesn't already exist" do diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb index e73d1a252f5..113703fac38 100644 --- a/spec/requests/api/commits_spec.rb +++ b/spec/requests/api/commits_spec.rb @@ -12,7 +12,7 @@ describe API::Commits do let(:current_user) { nil } before do - project.add_master(user) + project.add_maintainer(user) end describe 'GET /projects/:id/repository/commits' do @@ -55,7 +55,7 @@ describe API::Commits do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'project commits' @@ -667,7 +667,7 @@ describe API::Commits do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'ref commit' @@ -785,7 +785,7 @@ describe API::Commits do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'ref diff' @@ -884,7 +884,7 @@ describe API::Commits do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'ref comments' diff --git a/spec/requests/api/deployments_spec.rb b/spec/requests/api/deployments_spec.rb index 51b70fda148..61ae053cea7 100644 --- a/spec/requests/api/deployments_spec.rb +++ b/spec/requests/api/deployments_spec.rb @@ -5,7 +5,7 @@ describe API::Deployments do let(:non_member) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) end describe 'GET /projects/:id/deployments' do diff --git a/spec/requests/api/environments_spec.rb b/spec/requests/api/environments_spec.rb index fdddca5d0ef..bf93555b0f0 100644 --- a/spec/requests/api/environments_spec.rb +++ b/spec/requests/api/environments_spec.rb @@ -7,7 +7,7 @@ describe API::Environments do let!(:environment) { create(:environment, project: project) } before do - project.add_master(user) + project.add_maintainer(user) end describe 'GET /projects/:id/environments' do @@ -126,7 +126,7 @@ describe API::Environments do end describe 'DELETE /projects/:id/environments/:environment_id' do - context 'as a master' do + context 'as a maintainer' do it 'returns a 200 for an existing environment' do delete api("/projects/#{project.id}/environments/#{environment.id}", user) @@ -155,7 +155,7 @@ describe API::Environments do end describe 'POST /projects/:id/environments/:environment_id/stop' do - context 'as a master' do + context 'as a maintainer' do context 'with a stoppable environment' do before do environment.update(state: :available) diff --git a/spec/requests/api/group_variables_spec.rb b/spec/requests/api/group_variables_spec.rb index 64fa7dc824c..f87e035c89d 100644 --- a/spec/requests/api/group_variables_spec.rb +++ b/spec/requests/api/group_variables_spec.rb @@ -9,7 +9,7 @@ describe API::GroupVariables do context 'authorized user with proper permissions' do before do - group.add_master(user) + group.add_maintainer(user) end it 'returns group variables' do @@ -42,7 +42,7 @@ describe API::GroupVariables do context 'authorized user with proper permissions' do before do - group.add_master(user) + group.add_maintainer(user) end it 'returns group variable details' do @@ -82,7 +82,7 @@ describe API::GroupVariables do let!(:variable) { create(:ci_group_variable, group: group) } before do - group.add_master(user) + group.add_maintainer(user) end it 'creates variable' do @@ -138,7 +138,7 @@ describe API::GroupVariables do context 'authorized user with proper permissions' do before do - group.add_master(user) + group.add_maintainer(user) end it 'updates variable data' do @@ -184,7 +184,7 @@ describe API::GroupVariables do context 'authorized user with proper permissions' do before do - group.add_master(user) + group.add_maintainer(user) end it 'deletes variable' do diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index da23fdd7dca..65b387a2170 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -215,7 +215,7 @@ describe API::Groups do context 'when using owned in the request' do it 'returns an array of groups the user owns' do - group1.add_master(user2) + group1.add_maintainer(user2) get api('/groups', user2), owned: true @@ -251,14 +251,22 @@ describe API::Groups do projects end + def response_project_ids(json_response, key) + json_response[key].map do |project| + project['id'].to_i + end + end + context 'when unauthenticated' do it 'returns 404 for a private group' do get api("/groups/#{group2.id}") + expect(response).to have_gitlab_http_status(404) end it 'returns 200 for a public group' do get api("/groups/#{group1.id}") + expect(response).to have_gitlab_http_status(200) end @@ -268,7 +276,7 @@ describe API::Groups do get api("/groups/#{public_group.id}") - expect(json_response['projects'].map { |p| p['id'].to_i }) + expect(response_project_ids(json_response, 'projects')) .to contain_exactly(projects[:public].id) end @@ -278,7 +286,7 @@ describe API::Groups do get api("/groups/#{group1.id}") - expect(json_response['shared_projects'].map { |p| p['id'].to_i }) + expect(response_project_ids(json_response, 'shared_projects')) .to contain_exactly(projects[:public].id) end end @@ -309,6 +317,17 @@ describe API::Groups do expect(json_response['shared_projects'][0]['id']).to eq(project.id) end + it "returns one of user1's groups without projects when with_projects option is set to false" do + project = create(:project, namespace: group2, path: 'Foo') + create(:project_group_link, project: project, group: group1) + + get api("/groups/#{group1.id}", user1), with_projects: false + + expect(response).to have_gitlab_http_status(200) + expect(json_response['projects']).to be_nil + expect(json_response['shared_projects']).to be_nil + end + it "does not return a non existing group" do get api("/groups/1328", user1) @@ -327,7 +346,7 @@ describe API::Groups do get api("/groups/#{public_group.id}", user2) - expect(json_response['projects'].map { |p| p['id'].to_i }) + expect(response_project_ids(json_response, 'projects')) .to contain_exactly(projects[:public].id, projects[:internal].id) end @@ -337,7 +356,7 @@ describe API::Groups do get api("/groups/#{group1.id}", user2) - expect(json_response['shared_projects'].map { |p| p['id'].to_i }) + expect(response_project_ids(json_response, 'shared_projects')) .to contain_exactly(projects[:public].id, projects[:internal].id) end end @@ -715,9 +734,9 @@ describe API::Groups do end end - context 'as master', :nested_groups do + context 'as maintainer', :nested_groups do before do - group2.add_master(user1) + group2.add_maintainer(user1) end it 'cannot create subgroups' do @@ -793,7 +812,7 @@ describe API::Groups do it "does not remove a group if not an owner" do user4 = create(:user) - group1.add_master(user4) + group1.add_maintainer(user4) delete api("/groups/#{group1.id}", user3) diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 95eff029f98..66eb18229fa 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -1083,7 +1083,7 @@ describe API::Issues do let(:project) { merge_request.source_project } before do - project.add_master(user) + project.add_maintainer(user) end context 'resolving all discussions in a merge request' do diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb index 50d6f4b4d99..7d1a5c12805 100644 --- a/spec/requests/api/jobs_spec.rb +++ b/spec/requests/api/jobs_spec.rb @@ -535,12 +535,14 @@ describe API::Jobs do context 'authorized user' do context 'when trace is in ObjectStorage' do let!(:job) { create(:ci_build, :trace_artifact, pipeline: pipeline) } + let(:url) { 'http://object-storage/trace' } + let(:file_path) { expand_fixture_path('trace/sample_trace') } before do - stub_remote_trace_206 + stub_remote_url_206(url, file_path) allow_any_instance_of(JobArtifactUploader).to receive(:file_storage?) { false } - allow_any_instance_of(JobArtifactUploader).to receive(:url) { remote_trace_url } - allow_any_instance_of(JobArtifactUploader).to receive(:size) { remote_trace_size } + allow_any_instance_of(JobArtifactUploader).to receive(:url) { url } + allow_any_instance_of(JobArtifactUploader).to receive(:size) { File.size(file_path) } end it 'returns specific job trace' do @@ -643,7 +645,7 @@ describe API::Jobs do end describe 'POST /projects/:id/jobs/:job_id/erase' do - let(:role) { :master } + let(:role) { :maintainer } before do project.add_role(user, role) diff --git a/spec/requests/api/labels_spec.rb b/spec/requests/api/labels_spec.rb index 34cbf75f4c1..a4220f5b2be 100644 --- a/spec/requests/api/labels_spec.rb +++ b/spec/requests/api/labels_spec.rb @@ -7,7 +7,7 @@ describe API::Labels do let!(:priority_label) { create(:label, title: 'bug', project: project, priority: 3) } before do - project.add_master(user) + project.add_maintainer(user) end describe 'GET /projects/:id/labels' do diff --git a/spec/requests/api/members_spec.rb b/spec/requests/api/members_spec.rb index ec500838eb2..01bbe7f5ec6 100644 --- a/spec/requests/api/members_spec.rb +++ b/spec/requests/api/members_spec.rb @@ -1,15 +1,15 @@ require 'spec_helper' describe API::Members do - let(:master) { create(:user, username: 'master_user') } + let(:maintainer) { create(:user, username: 'maintainer_user') } let(:developer) { create(:user) } let(:access_requester) { create(:user) } let(:stranger) { create(:user) } let(:project) do - create(:project, :public, :access_requestable, creator_id: master.id, namespace: master.namespace) do |project| + create(:project, :public, :access_requestable, creator_id: maintainer.id, namespace: maintainer.namespace) do |project| project.add_developer(developer) - project.add_master(master) + project.add_maintainer(maintainer) project.request_access(access_requester) end end @@ -17,7 +17,7 @@ describe API::Members do let!(:group) do create(:group, :public, :access_requestable) do |group| group.add_developer(developer) - group.add_owner(master) + group.add_owner(maintainer) group.request_access(access_requester) end end @@ -28,7 +28,7 @@ describe API::Members do let(:route) { get api("/#{source_type.pluralize}/#{source.id}/members", stranger) } end - %i[master developer access_requester stranger].each do |type| + %i[maintainer developer access_requester stranger].each do |type| context "when authenticated as a #{type}" do it 'returns 200' do user = public_send(type) @@ -39,23 +39,23 @@ describe API::Members do expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.size).to eq(2) - expect(json_response.map { |u| u['id'] }).to match_array [master.id, developer.id] + expect(json_response.map { |u| u['id'] }).to match_array [maintainer.id, developer.id] end end end it 'avoids N+1 queries' do # Establish baseline - get api("/#{source_type.pluralize}/#{source.id}/members", master) + get api("/#{source_type.pluralize}/#{source.id}/members", maintainer) control = ActiveRecord::QueryRecorder.new do - get api("/#{source_type.pluralize}/#{source.id}/members", master) + get api("/#{source_type.pluralize}/#{source.id}/members", maintainer) end project.add_developer(create(:user)) expect do - get api("/#{source_type.pluralize}/#{source.id}/members", master) + get api("/#{source_type.pluralize}/#{source.id}/members", maintainer) end.not_to exceed_query_limit(control) end @@ -68,17 +68,17 @@ describe API::Members do expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.size).to eq(2) - expect(json_response.map { |u| u['id'] }).to match_array [master.id, developer.id] + expect(json_response.map { |u| u['id'] }).to match_array [maintainer.id, developer.id] end it 'finds members with query string' do - get api("/#{source_type.pluralize}/#{source.id}/members", developer), query: master.username + get api("/#{source_type.pluralize}/#{source.id}/members", developer), query: maintainer.username expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.count).to eq(1) - expect(json_response.first['username']).to eq(master.username) + expect(json_response.first['username']).to eq(maintainer.username) end it 'finds all members with no query specified' do @@ -88,7 +88,7 @@ describe API::Members do expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.count).to eq(2) - expect(json_response.map { |u| u['id'] }).to match_array [master.id, developer.id] + expect(json_response.map { |u| u['id'] }).to match_array [maintainer.id, developer.id] end end end @@ -129,7 +129,7 @@ describe API::Members do it_behaves_like 'a 404 response when source is private' do let(:route) do post api("/#{source_type.pluralize}/#{source.id}/members", stranger), - user_id: access_requester.id, access_level: Member::MASTER + user_id: access_requester.id, access_level: Member::MAINTAINER end end @@ -139,7 +139,7 @@ describe API::Members do it 'returns 403' do user = public_send(type) post api("/#{source_type.pluralize}/#{source.id}/members", user), - user_id: access_requester.id, access_level: Member::MASTER + user_id: access_requester.id, access_level: Member::MAINTAINER expect(response).to have_gitlab_http_status(403) end @@ -147,24 +147,24 @@ describe API::Members do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do context 'and new member is already a requester' do it 'transforms the requester into a proper member' do expect do - post api("/#{source_type.pluralize}/#{source.id}/members", master), - user_id: access_requester.id, access_level: Member::MASTER + post api("/#{source_type.pluralize}/#{source.id}/members", maintainer), + user_id: access_requester.id, access_level: Member::MAINTAINER expect(response).to have_gitlab_http_status(201) end.to change { source.members.count }.by(1) expect(source.requesters.count).to eq(0) expect(json_response['id']).to eq(access_requester.id) - expect(json_response['access_level']).to eq(Member::MASTER) + expect(json_response['access_level']).to eq(Member::MAINTAINER) end end it 'creates a new member' do expect do - post api("/#{source_type.pluralize}/#{source.id}/members", master), + post api("/#{source_type.pluralize}/#{source.id}/members", maintainer), user_id: stranger.id, access_level: Member::DEVELOPER, expires_at: '2016-08-05' expect(response).to have_gitlab_http_status(201) @@ -176,28 +176,28 @@ describe API::Members do end it "returns 409 if member already exists" do - post api("/#{source_type.pluralize}/#{source.id}/members", master), - user_id: master.id, access_level: Member::MASTER + post api("/#{source_type.pluralize}/#{source.id}/members", maintainer), + user_id: maintainer.id, access_level: Member::MAINTAINER expect(response).to have_gitlab_http_status(409) end it 'returns 400 when user_id is not given' do - post api("/#{source_type.pluralize}/#{source.id}/members", master), - access_level: Member::MASTER + post api("/#{source_type.pluralize}/#{source.id}/members", maintainer), + access_level: Member::MAINTAINER expect(response).to have_gitlab_http_status(400) end it 'returns 400 when access_level is not given' do - post api("/#{source_type.pluralize}/#{source.id}/members", master), + post api("/#{source_type.pluralize}/#{source.id}/members", maintainer), user_id: stranger.id expect(response).to have_gitlab_http_status(400) end it 'returns 400 when access_level is not valid' do - post api("/#{source_type.pluralize}/#{source.id}/members", master), + post api("/#{source_type.pluralize}/#{source.id}/members", maintainer), user_id: stranger.id, access_level: 1234 expect(response).to have_gitlab_http_status(400) @@ -210,7 +210,7 @@ describe API::Members do it_behaves_like 'a 404 response when source is private' do let(:route) do put api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", stranger), - access_level: Member::MASTER + access_level: Member::MAINTAINER end end @@ -220,7 +220,7 @@ describe API::Members do it 'returns 403' do user = public_send(type) put api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", user), - access_level: Member::MASTER + access_level: Member::MAINTAINER expect(response).to have_gitlab_http_status(403) end @@ -228,33 +228,33 @@ describe API::Members do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do it 'updates the member' do - put api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", master), - access_level: Member::MASTER, expires_at: '2016-08-05' + put api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", maintainer), + access_level: Member::MAINTAINER, expires_at: '2016-08-05' expect(response).to have_gitlab_http_status(200) expect(json_response['id']).to eq(developer.id) - expect(json_response['access_level']).to eq(Member::MASTER) + expect(json_response['access_level']).to eq(Member::MAINTAINER) expect(json_response['expires_at']).to eq('2016-08-05') end end it 'returns 409 if member does not exist' do - put api("/#{source_type.pluralize}/#{source.id}/members/123", master), - access_level: Member::MASTER + put api("/#{source_type.pluralize}/#{source.id}/members/123", maintainer), + access_level: Member::MAINTAINER expect(response).to have_gitlab_http_status(404) end it 'returns 400 when access_level is not given' do - put api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", master) + put api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", maintainer) expect(response).to have_gitlab_http_status(400) end it 'returns 400 when access level is not valid' do - put api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", master), + put api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", maintainer), access_level: 1234 expect(response).to have_gitlab_http_status(400) @@ -291,11 +291,11 @@ describe API::Members do end end - context 'when authenticated as a master/owner' do + context 'when authenticated as a maintainer/owner' do context 'and member is a requester' do it 'returns 404' do expect do - delete api("/#{source_type.pluralize}/#{source.id}/members/#{access_requester.id}", master) + delete api("/#{source_type.pluralize}/#{source.id}/members/#{access_requester.id}", maintainer) expect(response).to have_gitlab_http_status(404) end.not_to change { source.requesters.count } @@ -304,19 +304,19 @@ describe API::Members do it 'deletes the member' do expect do - delete api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", master) + delete api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", maintainer) expect(response).to have_gitlab_http_status(204) end.to change { source.members.count }.by(-1) end it_behaves_like '412 response' do - let(:request) { api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", master) } + let(:request) { api("/#{source_type.pluralize}/#{source.id}/members/#{developer.id}", maintainer) } end end it 'returns 404 if member does not exist' do - delete api("/#{source_type.pluralize}/#{source.id}/members/123", master) + delete api("/#{source_type.pluralize}/#{source.id}/members/123", maintainer) expect(response).to have_gitlab_http_status(404) end @@ -366,7 +366,7 @@ describe API::Members do context 'Adding owner to project' do it 'returns 403' do expect do - post api("/projects/#{project.id}/members", master), + post api("/projects/#{project.id}/members", maintainer), user_id: stranger.id, access_level: Member::OWNER expect(response).to have_gitlab_http_status(400) diff --git a/spec/requests/api/merge_request_diffs_spec.rb b/spec/requests/api/merge_request_diffs_spec.rb index cb647aee70f..6530dc956cb 100644 --- a/spec/requests/api/merge_request_diffs_spec.rb +++ b/spec/requests/api/merge_request_diffs_spec.rb @@ -8,7 +8,7 @@ describe API::MergeRequestDiffs, 'MergeRequestDiffs' do before do merge_request.merge_request_diffs.create(head_commit_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') merge_request.merge_request_diffs.create(head_commit_sha: '5937ac0a7beb003549fc5fd26fc247adbce4a52e') - project.add_master(user) + project.add_maintainer(user) end describe 'GET /projects/:id/merge_requests/:merge_request_iid/versions' do diff --git a/spec/requests/api/namespaces_spec.rb b/spec/requests/api/namespaces_spec.rb index 98102fcd6a7..e2000ab42e8 100644 --- a/spec/requests/api/namespaces_spec.rb +++ b/spec/requests/api/namespaces_spec.rb @@ -23,10 +23,10 @@ describe API::Namespaces do expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers - expect(group_kind_json_response.keys).to contain_exactly('id', 'kind', 'name', 'path', 'full_path', - 'parent_id', 'members_count_with_descendants') + expect(group_kind_json_response.keys).to include('id', 'kind', 'name', 'path', 'full_path', + 'parent_id', 'members_count_with_descendants') - expect(user_kind_json_response.keys).to contain_exactly('id', 'kind', 'name', 'path', 'full_path', 'parent_id') + expect(user_kind_json_response.keys).to include('id', 'kind', 'name', 'path', 'full_path', 'parent_id') end it "admin: returns an array of all namespaces" do @@ -58,8 +58,8 @@ describe API::Namespaces do owned_group_response = json_response.find { |resource| resource['id'] == group1.id } - expect(owned_group_response.keys).to contain_exactly('id', 'kind', 'name', 'path', 'full_path', - 'parent_id', 'members_count_with_descendants') + expect(owned_group_response.keys).to include('id', 'kind', 'name', 'path', 'full_path', + 'parent_id', 'members_count_with_descendants') end it "returns correct attributes when user cannot admin group" do @@ -69,7 +69,7 @@ describe API::Namespaces do guest_group_response = json_response.find { |resource| resource['id'] == group1.id } - expect(guest_group_response.keys).to contain_exactly('id', 'kind', 'name', 'path', 'full_path', 'parent_id') + expect(guest_group_response.keys).to include('id', 'kind', 'name', 'path', 'full_path', 'parent_id') end it "user: returns an array of namespaces" do diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index f4cf5bd0530..3fb45449c74 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -44,7 +44,7 @@ describe API::Notes do # For testing the cross-reference of a private issue in a public project let(:private_project) do create(:project, namespace: private_user.namespace) - .tap { |p| p.add_master(private_user) } + .tap { |p| p.add_maintainer(private_user) } end let(:private_issue) { create(:issue, project: private_project) } diff --git a/spec/requests/api/pages_domains_spec.rb b/spec/requests/api/pages_domains_spec.rb index a9ccbb32666..35b6ed8d5c0 100644 --- a/spec/requests/api/pages_domains_spec.rb +++ b/spec/requests/api/pages_domains_spec.rb @@ -80,7 +80,7 @@ describe API::PagesDomains do context 'when pages is disabled' do before do allow(Gitlab.config.pages).to receive(:enabled).and_return(false) - project.add_master(user) + project.add_maintainer(user) end it_behaves_like '404 response' do @@ -88,9 +88,9 @@ describe API::PagesDomains do end end - context 'when user is a master' do + context 'when user is a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'get pages domains' @@ -177,7 +177,7 @@ describe API::PagesDomains do context 'when domain is vacant' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like '404 response' do @@ -185,9 +185,9 @@ describe API::PagesDomains do end end - context 'when user is a master' do + context 'when user is a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'get pages domain' @@ -270,9 +270,9 @@ describe API::PagesDomains do end end - context 'when user is a master' do + context 'when user is a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'post pages domains' @@ -380,7 +380,7 @@ describe API::PagesDomains do context 'when domain is vacant' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like '404 response' do @@ -388,9 +388,9 @@ describe API::PagesDomains do end end - context 'when user is a master' do + context 'when user is a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'put pages domain' @@ -444,7 +444,7 @@ describe API::PagesDomains do context 'when domain is vacant' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like '404 response' do @@ -452,9 +452,9 @@ describe API::PagesDomains do end end - context 'when user is a master' do + context 'when user is a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'delete pages domain' diff --git a/spec/requests/api/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index 173f2a0dea0..997d413eb4f 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -270,38 +270,38 @@ describe API::PipelineSchedules do end describe 'DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id' do - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let!(:pipeline_schedule) do create(:ci_pipeline_schedule, project: project, owner: developer) end before do - project.add_master(master) + project.add_maintainer(maintainer) end context 'authenticated user with valid permissions' do it 'deletes pipeline_schedule' do expect do - delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", master) + delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", maintainer) end.to change { project.pipeline_schedules.count }.by(-1) expect(response).to have_gitlab_http_status(204) end it 'responds with 404 Not Found if requesting non-existing pipeline_schedule' do - delete api("/projects/#{project.id}/pipeline_schedules/-5", master) + delete api("/projects/#{project.id}/pipeline_schedules/-5", maintainer) expect(response).to have_gitlab_http_status(:not_found) end it_behaves_like '412 response' do - let(:request) { api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", master) } + let(:request) { api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", maintainer) } end end context 'authenticated user with invalid permissions' do - let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: master) } + let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: maintainer) } it 'does not delete pipeline_schedule' do delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", developer) @@ -415,7 +415,7 @@ describe API::PipelineSchedules do end describe 'DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do - let(:master) { create(:user) } + let(:maintainer) { create(:user) } set(:pipeline_schedule) do create(:ci_pipeline_schedule, project: project, owner: developer) @@ -426,13 +426,13 @@ describe API::PipelineSchedules do end before do - project.add_master(master) + project.add_maintainer(maintainer) end context 'authenticated user with valid permissions' do it 'deletes pipeline_schedule_variable' do expect do - delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", master) + delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", maintainer) end.to change { Ci::PipelineScheduleVariable.count }.by(-1) expect(response).to have_gitlab_http_status(:accepted) @@ -440,14 +440,14 @@ describe API::PipelineSchedules do end it 'responds with 404 Not Found if requesting non-existing pipeline_schedule_variable' do - delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/____", master) + delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/____", maintainer) expect(response).to have_gitlab_http_status(:not_found) end end context 'authenticated user with invalid permissions' do - let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: master) } + let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: maintainer) } it 'does not delete pipeline_schedule_variable' do delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", developer) diff --git a/spec/requests/api/pipelines_spec.rb b/spec/requests/api/pipelines_spec.rb index 78ea77cb3bb..e2ca27f5d41 100644 --- a/spec/requests/api/pipelines_spec.rb +++ b/spec/requests/api/pipelines_spec.rb @@ -11,7 +11,7 @@ describe API::Pipelines do end before do - project.add_master(user) + project.add_maintainer(user) end describe 'GET /projects/:id/pipelines ' do diff --git a/spec/requests/api/project_export_spec.rb b/spec/requests/api/project_export_spec.rb index a4615bd081f..45e4e35d773 100644 --- a/spec/requests/api/project_export_spec.rb +++ b/spec/requests/api/project_export_spec.rb @@ -109,13 +109,13 @@ describe API::ProjectExport do it_behaves_like 'get project export status ok' end - context 'when user is a master' do + context 'when user is a maintainer' do before do - project.add_master(user) - project_none.add_master(user) - project_started.add_master(user) - project_finished.add_master(user) - project_after_export.add_master(user) + project.add_maintainer(user) + project_none.add_maintainer(user) + project_started.add_maintainer(user) + project_finished.add_maintainer(user) + project_after_export.add_maintainer(user) end it_behaves_like 'get project export status ok' @@ -228,13 +228,13 @@ describe API::ProjectExport do it_behaves_like 'get project download by strategy' end - context 'when user is a master' do + context 'when user is a maintainer' do before do - project.add_master(user) - project_none.add_master(user) - project_started.add_master(user) - project_finished.add_master(user) - project_after_export.add_master(user) + project.add_maintainer(user) + project_none.add_maintainer(user) + project_started.add_maintainer(user) + project_finished.add_maintainer(user) + project_after_export.add_maintainer(user) end it_behaves_like 'get project download by strategy' @@ -274,7 +274,7 @@ describe API::ProjectExport do stub_uploads_object_storage(ImportExportUploader) [project, project_finished, project_after_export].each do |p| - p.add_master(user) + p.add_maintainer(user) upload = ImportExportUpload.new(project: p) upload.export_file = fixture_file_upload('spec/fixtures/project_export.tar.gz', "`/tar.gz") @@ -338,13 +338,13 @@ describe API::ProjectExport do it_behaves_like 'post project export start' end - context 'when user is a master' do + context 'when user is a maintainer' do before do - project.add_master(user) - project_none.add_master(user) - project_started.add_master(user) - project_finished.add_master(user) - project_after_export.add_master(user) + project.add_maintainer(user) + project_none.add_maintainer(user) + project_started.add_maintainer(user) + project_finished.add_maintainer(user) + project_after_export.add_maintainer(user) end it_behaves_like 'post project export start' diff --git a/spec/requests/api/project_hooks_spec.rb b/spec/requests/api/project_hooks_spec.rb index 12a183fed1e..bc45a63d9f1 100644 --- a/spec/requests/api/project_hooks_spec.rb +++ b/spec/requests/api/project_hooks_spec.rb @@ -13,7 +13,7 @@ describe API::ProjectHooks, 'ProjectHooks' do end before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user3) end @@ -214,7 +214,7 @@ describe API::ProjectHooks, 'ProjectHooks' do it "returns a 404 if a user attempts to delete project hooks he/she does not own" do test_user = create(:user) other_project = create(:project) - other_project.add_master(test_user) + other_project.add_maintainer(test_user) delete api("/projects/#{other_project.id}/hooks/#{hook.id}", test_user) expect(response).to have_gitlab_http_status(404) diff --git a/spec/requests/api/project_import_spec.rb b/spec/requests/api/project_import_spec.rb index 24b7835abf5..41243854ebc 100644 --- a/spec/requests/api/project_import_spec.rb +++ b/spec/requests/api/project_import_spec.rb @@ -146,7 +146,7 @@ describe API::ProjectImport do describe 'GET /projects/:id/import' do it 'returns the import status' do project = create(:project, :import_started) - project.add_master(user) + project.add_maintainer(user) get api("/projects/#{project.id}/import", user) @@ -156,7 +156,7 @@ describe API::ProjectImport do it 'returns the import status and the error if failed' do project = create(:project, :import_failed) - project.add_master(user) + project.add_maintainer(user) project.import_state.update(last_error: 'error') get api("/projects/#{project.id}/import", user) diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index de540ba7a10..8389cb7cf9c 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -40,7 +40,7 @@ describe API::Projects do create(:project_member, user: user4, project: project3, - access_level: ProjectMember::MASTER) + access_level: ProjectMember::MAINTAINER) end let(:project4) do create(:project, @@ -353,7 +353,7 @@ describe API::Projects do create(:project_member, user: user, project: project5, - access_level: ProjectMember::MASTER) + access_level: ProjectMember::MAINTAINER) end it 'returns only projects that satisfy all query parameters' do @@ -961,7 +961,7 @@ describe API::Projects do describe 'permissions' do context 'all projects' do before do - project.add_master(user) + project.add_maintainer(user) end it 'contains permission information' do @@ -969,19 +969,19 @@ describe API::Projects do expect(response).to have_gitlab_http_status(200) expect(json_response.first['permissions']['project_access']['access_level']) - .to eq(Gitlab::Access::MASTER) + .to eq(Gitlab::Access::MAINTAINER) expect(json_response.first['permissions']['group_access']).to be_nil end end context 'personal project' do it 'sets project access and returns 200' do - project.add_master(user) + project.add_maintainer(user) get api("/projects/#{project.id}", user) expect(response).to have_gitlab_http_status(200) expect(json_response['permissions']['project_access']['access_level']) - .to eq(Gitlab::Access::MASTER) + .to eq(Gitlab::Access::MAINTAINER) expect(json_response['permissions']['group_access']).to be_nil end end @@ -1526,9 +1526,23 @@ describe API::Projects do expect(response).to have_gitlab_http_status(400) end + + it 'updates avatar' do + project_param = { + avatar: fixture_file_upload('spec/fixtures/banana_sample.gif', + 'image/gif') + } + + put api("/projects/#{project3.id}", user), project_param + + expect(response).to have_gitlab_http_status(200) + expect(json_response['avatar_url']).to eq('http://localhost/uploads/'\ + '-/system/project/avatar/'\ + "#{project3.id}/banana_sample.gif") + end end - context 'when authenticated as project master' do + context 'when authenticated as project maintainer' do it 'updates path' do project_param = { path: 'bar' } put api("/projects/#{project3.id}", user4), project_param diff --git a/spec/requests/api/protected_branches_spec.rb b/spec/requests/api/protected_branches_spec.rb index 576fde46615..69a601d7b40 100644 --- a/spec/requests/api/protected_branches_spec.rb +++ b/spec/requests/api/protected_branches_spec.rb @@ -26,9 +26,9 @@ describe API::ProtectedBranches do end end - context 'when authenticated as a master' do + context 'when authenticated as a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'protected branches' @@ -54,8 +54,8 @@ describe API::ProtectedBranches do expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq(branch_name) - expect(json_response['push_access_levels'][0]['access_level']).to eq(::Gitlab::Access::MASTER) - expect(json_response['merge_access_levels'][0]['access_level']).to eq(::Gitlab::Access::MASTER) + expect(json_response['push_access_levels'][0]['access_level']).to eq(::Gitlab::Access::MAINTAINER) + expect(json_response['merge_access_levels'][0]['access_level']).to eq(::Gitlab::Access::MAINTAINER) end context 'when protected branch does not exist' do @@ -68,9 +68,9 @@ describe API::ProtectedBranches do end end - context 'when authenticated as a master' do + context 'when authenticated as a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it_behaves_like 'protected branch' @@ -108,9 +108,9 @@ describe API::ProtectedBranches do expect(json_response['name']).to eq(branch_name) end - context 'when authenticated as a master' do + context 'when authenticated as a maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end it 'protects a single branch' do @@ -118,8 +118,8 @@ describe API::ProtectedBranches do expect(response).to have_gitlab_http_status(201) expect(json_response['name']).to eq(branch_name) - expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::MASTER) - expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::MASTER) + expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) + expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) end it 'protects a single branch and developers can push' do @@ -128,7 +128,7 @@ describe API::ProtectedBranches do expect(response).to have_gitlab_http_status(201) expect(json_response['name']).to eq(branch_name) expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::DEVELOPER) - expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::MASTER) + expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) end it 'protects a single branch and developers can merge' do @@ -136,7 +136,7 @@ describe API::ProtectedBranches do expect(response).to have_gitlab_http_status(201) expect(json_response['name']).to eq(branch_name) - expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::MASTER) + expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::DEVELOPER) end @@ -155,7 +155,7 @@ describe API::ProtectedBranches do expect(response).to have_gitlab_http_status(201) expect(json_response['name']).to eq(branch_name) expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::NO_ACCESS) - expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::MASTER) + expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) end it 'protects a single branch and no one can merge' do @@ -163,7 +163,7 @@ describe API::ProtectedBranches do expect(response).to have_gitlab_http_status(201) expect(json_response['name']).to eq(branch_name) - expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::MASTER) + expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::NO_ACCESS) end @@ -189,8 +189,8 @@ describe API::ProtectedBranches do post post_endpoint, name: branch_name expect_protection_to_be_successful - expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::MASTER) - expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::MASTER) + expect(json_response['push_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) + expect(json_response['merge_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) end end @@ -225,7 +225,7 @@ describe API::ProtectedBranches do let(:delete_endpoint) { api("/projects/#{project.id}/protected_branches/#{branch_name}", user) } before do - project.add_master(user) + project.add_maintainer(user) end it "unprotects a single branch" do diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb index 28f8564ae92..6063afc213d 100644 --- a/spec/requests/api/repositories_spec.rb +++ b/spec/requests/api/repositories_spec.rb @@ -8,7 +8,7 @@ describe API::Repositories do let(:user) { create(:user) } let(:guest) { create(:user).tap { |u| create(:project_member, :guest, user: u, project: project) } } let!(:project) { create(:project, :repository, creator: user) } - let!(:master) { create(:project_member, :master, user: user, project: project) } + let!(:maintainer) { create(:project_member, :maintainer, user: user, project: project) } describe "GET /projects/:id/repository/tree" do let(:route) { "/projects/#{project.id}/repository/tree" } diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index b5e4b6011ea..3ebdb54f71f 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -18,8 +18,8 @@ describe API::Runners do before do # Set project access for users - create(:project_member, :master, user: user, project: project) - create(:project_member, :master, user: user, project: project2) + create(:project_member, :maintainer, user: user, project: project) + create(:project_member, :maintainer, user: user, project: project2) create(:project_member, :reporter, user: user2, project: project) end @@ -211,6 +211,69 @@ describe API::Runners do describe 'PUT /runners/:id' do context 'admin user' do + # see https://gitlab.com/gitlab-org/gitlab-ce/issues/48625 + context 'single parameter update' do + it 'runner description' do + description = shared_runner.description + update_runner(shared_runner.id, admin, description: "#{description}_updated") + + expect(response).to have_gitlab_http_status(200) + expect(shared_runner.reload.description).to eq("#{description}_updated") + end + + it 'runner active state' do + active = shared_runner.active + update_runner(shared_runner.id, admin, active: !active) + + expect(response).to have_gitlab_http_status(200) + expect(shared_runner.reload.active).to eq(!active) + end + + it 'runner tag list' do + update_runner(shared_runner.id, admin, tag_list: ['ruby2.1', 'pgsql', 'mysql']) + + expect(response).to have_gitlab_http_status(200) + expect(shared_runner.reload.tag_list).to include('ruby2.1', 'pgsql', 'mysql') + end + + it 'runner untagged flag' do + # Ensure tag list is non-empty before setting untagged to false. + update_runner(shared_runner.id, admin, tag_list: ['ruby2.1', 'pgsql', 'mysql']) + update_runner(shared_runner.id, admin, run_untagged: 'false') + + expect(response).to have_gitlab_http_status(200) + expect(shared_runner.reload.run_untagged?).to be(false) + end + + it 'runner unlocked flag' do + update_runner(shared_runner.id, admin, locked: 'true') + + expect(response).to have_gitlab_http_status(200) + expect(shared_runner.reload.locked?).to be(true) + end + + it 'runner access level' do + update_runner(shared_runner.id, admin, access_level: 'ref_protected') + + expect(response).to have_gitlab_http_status(200) + expect(shared_runner.reload.ref_protected?).to be_truthy + end + + it 'runner maximum timeout' do + update_runner(shared_runner.id, admin, maximum_timeout: 1234) + + expect(response).to have_gitlab_http_status(200) + expect(shared_runner.reload.maximum_timeout).to eq(1234) + end + + it 'fails with no parameters' do + put api("/runners/#{shared_runner.id}", admin) + + shared_runner.reload + expect(response).to have_gitlab_http_status(400) + end + end + context 'when runner is shared' do it 'updates runner' do description = shared_runner.description @@ -513,7 +576,7 @@ describe API::Runners do end describe 'GET /projects/:id/runners' do - context 'authorized user with master privileges' do + context 'authorized user with maintainer privileges' do it "returns project's runners" do get api("/projects/#{project.id}/runners", user) @@ -526,7 +589,7 @@ describe API::Runners do end end - context 'authorized user without master privileges' do + context 'authorized user without maintainer privileges' do it "does not return project's runners" do get api("/projects/#{project.id}/runners", user2) diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb index 8df08dd1818..98f995df06f 100644 --- a/spec/requests/api/tags_spec.rb +++ b/spec/requests/api/tags_spec.rb @@ -10,7 +10,7 @@ describe API::Tags do let(:current_user) { nil } before do - project.add_master(user) + project.add_maintainer(user) end describe 'GET /projects/:id/repository/tags' do @@ -86,7 +86,7 @@ describe API::Tags do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'repository tags' @@ -168,7 +168,7 @@ describe API::Tags do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'repository tag' @@ -222,7 +222,7 @@ describe API::Tags do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } context "when a protected branch doesn't already exist" do @@ -341,7 +341,7 @@ describe API::Tags do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'repository delete tag' @@ -386,7 +386,7 @@ describe API::Tags do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'repository new release' @@ -452,7 +452,7 @@ describe API::Tags do end end - context 'when authenticated', 'as a master' do + context 'when authenticated', 'as a maintainer' do let(:current_user) { user } it_behaves_like 'repository update release' diff --git a/spec/requests/api/triggers_spec.rb b/spec/requests/api/triggers_spec.rb index b2c56f7af2c..0ae6796d1e4 100644 --- a/spec/requests/api/triggers_spec.rb +++ b/spec/requests/api/triggers_spec.rb @@ -6,7 +6,7 @@ describe API::Triggers do let!(:trigger_token) { 'secure_token' } let!(:trigger_token_2) { 'secure_token_2' } let!(:project) { create(:project, :repository, creator: user) } - let!(:master) { create(:project_member, :master, user: user, project: project) } + let!(:maintainer) { create(:project_member, :maintainer, user: user, project: project) } let!(:developer) { create(:project_member, :developer, user: user2, project: project) } let!(:trigger) { create(:ci_trigger, project: project, token: trigger_token, owner: user) } let!(:trigger2) { create(:ci_trigger, project: project, token: trigger_token_2, owner: user2) } diff --git a/spec/requests/api/variables_spec.rb b/spec/requests/api/variables_spec.rb index 62215ea3d7d..be333df1d78 100644 --- a/spec/requests/api/variables_spec.rb +++ b/spec/requests/api/variables_spec.rb @@ -4,7 +4,7 @@ describe API::Variables do let(:user) { create(:user) } let(:user2) { create(:user) } let!(:project) { create(:project, creator_id: user.id) } - let!(:master) { create(:project_member, :master, user: user, project: project) } + let!(:maintainer) { create(:project_member, :maintainer, user: user, project: project) } let!(:developer) { create(:project_member, :developer, user: user2, project: project) } let!(:variable) { create(:ci_variable, project: project) } diff --git a/spec/requests/api/wikis_spec.rb b/spec/requests/api/wikis_spec.rb index 850ba696098..489cb001b82 100644 --- a/spec/requests/api/wikis_spec.rb +++ b/spec/requests/api/wikis_spec.rb @@ -7,7 +7,7 @@ require 'spec_helper' # Every state is tested for 3 user roles: # - guest # - developer -# - master +# - maintainer # because they are 3 edge cases of using wiki pages. describe API::Wikis do @@ -163,9 +163,9 @@ describe API::Wikis do include_examples '403 Forbidden' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) get api(url, user) end @@ -193,9 +193,9 @@ describe API::Wikis do include_examples 'returns list of wiki pages' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end include_examples 'returns list of wiki pages' @@ -221,9 +221,9 @@ describe API::Wikis do include_examples 'returns list of wiki pages' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end include_examples 'returns list of wiki pages' @@ -256,9 +256,9 @@ describe API::Wikis do include_examples '403 Forbidden' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) get api(url, user) end @@ -293,9 +293,9 @@ describe API::Wikis do end end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) get api(url, user) end @@ -337,9 +337,9 @@ describe API::Wikis do end end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) get api(url, user) end @@ -379,9 +379,9 @@ describe API::Wikis do include_examples '403 Forbidden' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) post(api(url, user), payload) end @@ -408,9 +408,9 @@ describe API::Wikis do include_examples 'creates wiki page' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end include_examples 'creates wiki page' @@ -436,9 +436,9 @@ describe API::Wikis do include_examples 'creates wiki page' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) end include_examples 'creates wiki page' @@ -472,9 +472,9 @@ describe API::Wikis do include_examples '403 Forbidden' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) put(api(url, user), payload) end @@ -510,9 +510,9 @@ describe API::Wikis do end end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) put(api(url, user), payload) end @@ -554,9 +554,9 @@ describe API::Wikis do end end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) put(api(url, user), payload) end @@ -607,9 +607,9 @@ describe API::Wikis do include_examples '403 Forbidden' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) delete(api(url, user)) end @@ -639,9 +639,9 @@ describe API::Wikis do include_examples '403 Forbidden' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) delete(api(url, user)) end @@ -671,9 +671,9 @@ describe API::Wikis do include_examples '403 Forbidden' end - context 'when user is master' do + context 'when user is maintainer' do before do - project.add_master(user) + project.add_maintainer(user) delete(api(url, user)) end diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb index 92fcfb65269..b030d9862c6 100644 --- a/spec/requests/git_http_spec.rb +++ b/spec/requests/git_http_spec.rb @@ -312,7 +312,7 @@ describe 'Git HTTP requests' do let(:project) { fork_project(canonical_project, nil, repository: true) } before do - canonical_project.add_master(user) + canonical_project.add_maintainer(user) create(:merge_request, source_project: project, target_project: canonical_project, @@ -398,13 +398,13 @@ describe 'Git HTTP requests' do context "when the user has access to the project" do before do - project.add_master(user) + project.add_maintainer(user) end context "when the user is blocked" do it "rejects pulls with 401 Unauthorized" do user.block - project.add_master(user) + project.add_maintainer(user) download(path, env) do |response| expect(response).to have_gitlab_http_status(:unauthorized) @@ -467,7 +467,7 @@ describe 'Git HTTP requests' do let(:path) { "#{project.full_path}.git" } before do - project.add_master(user) + project.add_maintainer(user) end context 'when username and password are provided' do @@ -827,7 +827,7 @@ describe 'Git HTTP requests' do context 'and the user is on the team' do before do - project.add_master(user) + project.add_maintainer(user) end it "responds with status 200" do @@ -850,7 +850,7 @@ describe 'Git HTTP requests' do let(:env) { { user: user.username, password: user.password } } before do - project.add_master(user) + project.add_maintainer(user) enforce_terms end diff --git a/spec/requests/lfs_http_spec.rb b/spec/requests/lfs_http_spec.rb index 4d30b99262e..de39abdb746 100644 --- a/spec/requests/lfs_http_spec.rb +++ b/spec/requests/lfs_http_spec.rb @@ -63,7 +63,7 @@ describe 'Git LFS API and storage' do context 'with LFS disabled globally' do before do - project.add_master(user) + project.add_maintainer(user) allow(Gitlab.config.lfs).to receive(:enabled).and_return(false) end @@ -106,7 +106,7 @@ describe 'Git LFS API and storage' do context 'with LFS enabled globally' do before do - project.add_master(user) + project.add_maintainer(user) enable_lfs end @@ -236,7 +236,7 @@ describe 'Git LFS API and storage' do context 'and does have project access' do let(:update_permissions) do - project.add_master(user) + project.add_maintainer(user) project.lfs_objects << lfs_object end @@ -293,7 +293,7 @@ describe 'Git LFS API and storage' do context 'when user allowed' do let(:update_permissions) do - project.add_master(user) + project.add_maintainer(user) project.lfs_objects << lfs_object end @@ -829,7 +829,7 @@ describe 'Git LFS API and storage' do context 'when user is not authenticated' do context 'when user has push access' do let(:update_user_permissions) do - project.add_master(user) + project.add_maintainer(user) end it 'responds with status 401' do @@ -874,7 +874,7 @@ describe 'Git LFS API and storage' do before do allow(Gitlab::Database).to receive(:read_only?) { true } - project.add_master(user) + project.add_maintainer(user) enable_lfs end @@ -1307,7 +1307,7 @@ describe 'Git LFS API and storage' do let(:authorization) { authorize_user } before do - second_project.add_master(user) + second_project.add_maintainer(user) upstream_project.lfs_objects << lfs_object end diff --git a/spec/requests/lfs_locks_api_spec.rb b/spec/requests/lfs_locks_api_spec.rb index e44a11a7232..a44b43a591f 100644 --- a/spec/requests/lfs_locks_api_spec.rb +++ b/spec/requests/lfs_locks_api_spec.rb @@ -4,7 +4,7 @@ describe 'Git LFS File Locking API' do include WorkhorseHelpers let(:project) { create(:project) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:developer) { create(:user) } let(:guest) { create(:user) } let(:path) { 'README.md' } @@ -29,7 +29,7 @@ describe 'Git LFS File Locking API' do before do allow(Gitlab.config.lfs).to receive(:enabled).and_return(true) - project.add_developer(master) + project.add_developer(maintainer) project.add_developer(developer) project.add_guest(guest) end @@ -99,7 +99,7 @@ describe 'Git LFS File Locking API' do include_examples 'unauthorized request' it 'returns the list of locked files grouped by owner' do - lock_file('README.md', master) + lock_file('README.md', maintainer) lock_file('README', developer) post_lfs_json url, nil, headers diff --git a/spec/serializers/deploy_key_entity_spec.rb b/spec/serializers/deploy_key_entity_spec.rb index 2bd8162d1b7..01264cf7fb5 100644 --- a/spec/serializers/deploy_key_entity_spec.rb +++ b/spec/serializers/deploy_key_entity_spec.rb @@ -44,9 +44,9 @@ describe DeployKeyEntity do it { expect(entity.as_json).to eq(expected_result) } end - describe 'returns can_edit true if user is a master of project' do + describe 'returns can_edit true if user is a maintainer of project' do before do - project.add_master(user) + project.add_maintainer(user) end it { expect(entity.as_json).to include(can_edit: true) } diff --git a/spec/serializers/environment_entity_spec.rb b/spec/serializers/environment_entity_spec.rb index 8f32c5639a1..b7324a26ed2 100644 --- a/spec/serializers/environment_entity_spec.rb +++ b/spec/serializers/environment_entity_spec.rb @@ -1,8 +1,9 @@ require 'spec_helper' describe EnvironmentEntity do + let(:request) { double('request') } let(:entity) do - described_class.new(environment, request: double) + described_class.new(environment, request: spy('request')) end let(:environment) { create(:environment) } diff --git a/spec/serializers/environment_serializer_spec.rb b/spec/serializers/environment_serializer_spec.rb index ca9b520fb38..0f0ab5ac796 100644 --- a/spec/serializers/environment_serializer_spec.rb +++ b/spec/serializers/environment_serializer_spec.rb @@ -54,7 +54,9 @@ describe EnvironmentSerializer do context 'when representing environments within folders' do let(:serializer) do - described_class.new(project: project).within_folders + described_class + .new(current_user: user, project: project) + .within_folders end let(:resource) { Environment.all } @@ -123,7 +125,8 @@ describe EnvironmentSerializer do let(:pagination) { { page: 1, per_page: 2 } } let(:serializer) do - described_class.new(project: project) + described_class + .new(current_user: user, project: project) .with_pagination(request, response) end @@ -169,7 +172,8 @@ describe EnvironmentSerializer do context 'when grouping environments within folders' do let(:serializer) do - described_class.new(project: project) + described_class + .new(current_user: user, project: project) .with_pagination(request, response) .within_folders end diff --git a/spec/serializers/group_child_entity_spec.rb b/spec/serializers/group_child_entity_spec.rb index 505a9eaac5a..dbc40bddc30 100644 --- a/spec/serializers/group_child_entity_spec.rb +++ b/spec/serializers/group_child_entity_spec.rb @@ -42,7 +42,7 @@ describe GroupChildEntity do end before do - object.add_master(user) + object.add_maintainer(user) end it 'has the correct type' do diff --git a/spec/services/auth/container_registry_authentication_service_spec.rb b/spec/services/auth/container_registry_authentication_service_spec.rb index fce73e0ac1f..037484931b8 100644 --- a/spec/services/auth/container_registry_authentication_service_spec.rb +++ b/spec/services/auth/container_registry_authentication_service_spec.rb @@ -348,7 +348,7 @@ describe Auth::ContainerRegistryAuthenticationService do end end - context 'delete authorized as master' do + context 'delete authorized as maintainer' do let(:current_project) { create(:project) } let(:current_user) { create(:user) } @@ -357,7 +357,7 @@ describe Auth::ContainerRegistryAuthenticationService do end before do - current_project.add_master(current_user) + current_project.add_maintainer(current_user) end it_behaves_like 'a valid token' diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 2b88fcc9a96..054b7b1561c 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -462,11 +462,11 @@ describe Ci::CreatePipelineService do end end - context 'when user is master' do + context 'when user is maintainer' do let(:pipeline) { execute_service } before do - project.add_master(user) + project.add_maintainer(user) end it 'creates a protected pipeline' do @@ -503,13 +503,13 @@ describe Ci::CreatePipelineService do end end - context 'when trigger belongs to a master' do + context 'when trigger belongs to a maintainer' do let(:user) { create(:user) } let(:trigger) { create(:ci_trigger, owner: user) } let(:trigger_request) { create(:ci_trigger_request, trigger: trigger) } before do - project.add_master(user) + project.add_maintainer(user) end it 'creates a pipeline' do diff --git a/spec/services/ci/retry_pipeline_service_spec.rb b/spec/services/ci/retry_pipeline_service_spec.rb index 688d3b8c038..55445e71539 100644 --- a/spec/services/ci/retry_pipeline_service_spec.rb +++ b/spec/services/ci/retry_pipeline_service_spec.rb @@ -237,7 +237,7 @@ describe Ci::RetryPipelineService, '#execute' do context 'when user is not allowed to trigger manual action' do before do project.add_developer(user) - create(:protected_branch, :masters_can_push, + create(:protected_branch, :maintainers_can_push, name: pipeline.ref, project: project) end @@ -275,7 +275,7 @@ describe Ci::RetryPipelineService, '#execute' do let(:pipeline) { create(:ci_pipeline, project: forked_project, ref: 'fixes') } before do - project.add_master(user) + project.add_maintainer(user) create(:merge_request, source_project: forked_project, target_project: project, diff --git a/spec/services/ci/stop_environments_service_spec.rb b/spec/services/ci/stop_environments_service_spec.rb index 3fc4e499b0c..cdd3d851f61 100644 --- a/spec/services/ci/stop_environments_service_spec.rb +++ b/spec/services/ci/stop_environments_service_spec.rb @@ -86,7 +86,7 @@ describe Ci::StopEnvironmentsService do context 'when user has permission to stop environments' do before do - project.add_master(user) + project.add_maintainer(user) end it 'does not stop environment' do diff --git a/spec/services/discussions/resolve_service_spec.rb b/spec/services/discussions/resolve_service_spec.rb index 3895a0b3aea..4e0d4749239 100644 --- a/spec/services/discussions/resolve_service_spec.rb +++ b/spec/services/discussions/resolve_service_spec.rb @@ -9,7 +9,7 @@ describe Discussions::ResolveService do let(:service) { described_class.new(discussion.noteable.project, user, merge_request: merge_request) } before do - project.add_master(user) + project.add_maintainer(user) end it "doesn't resolve discussions the user can't resolve" do diff --git a/spec/services/files/create_service_spec.rb b/spec/services/files/create_service_spec.rb index abe99b9e794..30d94e4318d 100644 --- a/spec/services/files/create_service_spec.rb +++ b/spec/services/files/create_service_spec.rb @@ -23,7 +23,7 @@ describe Files::CreateService do subject { described_class.new(project, user, commit_params) } before do - project.add_master(user) + project.add_maintainer(user) end describe "#execute" do diff --git a/spec/services/files/delete_service_spec.rb b/spec/services/files/delete_service_spec.rb index ace5f293097..73566afe8c8 100644 --- a/spec/services/files/delete_service_spec.rb +++ b/spec/services/files/delete_service_spec.rb @@ -37,7 +37,7 @@ describe Files::DeleteService do end before do - project.add_master(user) + project.add_maintainer(user) end describe "#execute" do diff --git a/spec/services/files/multi_service_spec.rb b/spec/services/files/multi_service_spec.rb index 59984c10990..3bdedaf3770 100644 --- a/spec/services/files/multi_service_spec.rb +++ b/spec/services/files/multi_service_spec.rb @@ -38,7 +38,7 @@ describe Files::MultiService do end before do - project.add_master(user) + project.add_maintainer(user) end describe '#execute' do diff --git a/spec/services/files/update_service_spec.rb b/spec/services/files/update_service_spec.rb index eaee89fb1a5..e01fe487ffa 100644 --- a/spec/services/files/update_service_spec.rb +++ b/spec/services/files/update_service_spec.rb @@ -24,7 +24,7 @@ describe Files::UpdateService do end before do - project.add_master(user) + project.add_maintainer(user) end describe "#execute" do diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index 35826de5814..3f62e7e61e1 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -11,7 +11,7 @@ describe GitPushService, services: true do let(:ref) { 'refs/heads/master' } before do - project.add_master(user) + project.add_maintainer(user) end describe 'with remote mirrors' do @@ -267,8 +267,8 @@ describe GitPushService, services: true do expect(project.default_branch).to eq("master") execute_service(project, user, blankrev, 'newrev', ref) expect(project.protected_branches).not_to be_empty - expect(project.protected_branches.first.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER]) - expect(project.protected_branches.first.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER]) + expect(project.protected_branches.first.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MAINTAINER]) + expect(project.protected_branches.first.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MAINTAINER]) end it "when pushing a branch for the first time with default branch protection disabled" do @@ -290,7 +290,7 @@ describe GitPushService, services: true do expect(project.protected_branches).not_to be_empty expect(project.protected_branches.last.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::DEVELOPER]) - expect(project.protected_branches.last.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER]) + expect(project.protected_branches.last.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MAINTAINER]) end it "when pushing a branch for the first time with an existing branch permission configured" do @@ -315,7 +315,7 @@ describe GitPushService, services: true do expect(project.default_branch).to eq("master") execute_service(project, user, blankrev, 'newrev', ref) expect(project.protected_branches).not_to be_empty - expect(project.protected_branches.first.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER]) + expect(project.protected_branches.first.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MAINTAINER]) expect(project.protected_branches.first.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::DEVELOPER]) end @@ -442,7 +442,7 @@ describe GitPushService, services: true do allow_any_instance_of(ProcessCommitWorker).to receive(:build_commit) .and_return(closing_commit) - project.add_master(commit_author) + project.add_maintainer(commit_author) end context "to default branches" do diff --git a/spec/services/groups/update_service_spec.rb b/spec/services/groups/update_service_spec.rb index 1737fd0a9fc..48d689e11d4 100644 --- a/spec/services/groups/update_service_spec.rb +++ b/spec/services/groups/update_service_spec.rb @@ -12,7 +12,7 @@ describe Groups::UpdateService do let!(:service) { described_class.new(public_group, user, visibility_level: Gitlab::VisibilityLevel::INTERNAL) } before do - public_group.add_user(user, Gitlab::Access::MASTER) + public_group.add_user(user, Gitlab::Access::MAINTAINER) create(:project, :public, group: public_group) end @@ -26,7 +26,7 @@ describe Groups::UpdateService do let!(:service) { described_class.new(internal_group, user, visibility_level: Gitlab::VisibilityLevel::PRIVATE) } before do - internal_group.add_user(user, Gitlab::Access::MASTER) + internal_group.add_user(user, Gitlab::Access::MAINTAINER) create(:project, :internal, group: internal_group) end @@ -55,7 +55,7 @@ describe Groups::UpdateService do context "unauthorized visibility_level validation" do let!(:service) { described_class.new(internal_group, user, visibility_level: 99) } before do - internal_group.add_user(user, Gitlab::Access::MASTER) + internal_group.add_user(user, Gitlab::Access::MAINTAINER) end it "does not change permission level" do @@ -68,7 +68,7 @@ describe Groups::UpdateService do let!(:service) { described_class.new(internal_group, user, path: SecureRandom.hex) } before do - internal_group.add_user(user, Gitlab::Access::MASTER) + internal_group.add_user(user, Gitlab::Access::MAINTAINER) create(:project, :internal, group: internal_group) end diff --git a/spec/services/issues/close_service_spec.rb b/spec/services/issues/close_service_spec.rb index 7ae49c06896..5e38d0aeb6a 100644 --- a/spec/services/issues/close_service_spec.rb +++ b/spec/services/issues/close_service_spec.rb @@ -9,7 +9,7 @@ describe Issues::CloseService do let!(:todo) { create(:todo, :assigned, user: user, project: project, target: issue, author: user2) } before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user2) project.add_guest(guest) end diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index 79bcdc41fb0..c61c1ddcb3d 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -13,8 +13,8 @@ describe Issues::CreateService do let(:labels) { create_pair(:label, project: project) } before do - project.add_master(user) - project.add_master(assignee) + project.add_maintainer(user) + project.add_maintainer(assignee) end let(:opts) do @@ -130,7 +130,7 @@ describe Issues::CreateService do end it 'invalidates open issues counter for assignees when issue is assigned' do - project.add_master(assignee) + project.add_maintainer(assignee) described_class.new(project, user, opts).execute @@ -160,7 +160,7 @@ describe Issues::CreateService do context 'issue create service' do context 'assignees' do before do - project.add_master(user) + project.add_maintainer(user) end it 'removes assignee when user id is invalid' do @@ -180,7 +180,7 @@ describe Issues::CreateService do end it 'saves assignee when user id is valid' do - project.add_master(assignee) + project.add_maintainer(assignee) opts = { title: 'Title', description: 'Description', assignee_ids: [assignee.id] } issue = described_class.new(project, user, opts).execute @@ -224,8 +224,8 @@ describe Issues::CreateService do end before do - project.add_master(user) - project.add_master(assignee) + project.add_maintainer(user) + project.add_maintainer(assignee) end it 'assigns and sets milestone to issuable from command' do @@ -242,7 +242,7 @@ describe Issues::CreateService do let(:project) { merge_request.source_project } before do - project.add_master(user) + project.add_maintainer(user) end describe 'for a single discussion' do diff --git a/spec/services/issues/reopen_service_spec.rb b/spec/services/issues/reopen_service_spec.rb index 42e5d544f4c..3b617d4ca54 100644 --- a/spec/services/issues/reopen_service_spec.rb +++ b/spec/services/issues/reopen_service_spec.rb @@ -24,7 +24,7 @@ describe Issues::ReopenService do let(:user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) end it 'invalidates counter cache for assignees' do diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 4cbf1a52e29..fa98d05c61b 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -18,7 +18,7 @@ describe Issues::UpdateService, :mailer do end before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user2) project.add_developer(user3) end @@ -596,7 +596,7 @@ describe Issues::UpdateService, :mailer do context 'valid project' do before do - target_project.add_master(user) + target_project.add_maintainer(user) end it 'calls the move service with the proper issue and project' do diff --git a/spec/services/lfs/unlock_file_service_spec.rb b/spec/services/lfs/unlock_file_service_spec.rb index 948401d7bdc..539417644db 100644 --- a/spec/services/lfs/unlock_file_service_spec.rb +++ b/spec/services/lfs/unlock_file_service_spec.rb @@ -62,11 +62,11 @@ describe Lfs::UnlockFileService do context 'when forced' do let(:developer) { create(:user) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } before do project.add_developer(developer) - project.add_master(master) + project.add_maintainer(maintainer) end context 'by a regular user' do @@ -86,7 +86,7 @@ describe Lfs::UnlockFileService do end context 'by a maintainer user' do - let(:current_user) { master } + let(:current_user) { maintainer } let(:params) do { id: lock.id, force: true } diff --git a/spec/services/members/approve_access_request_service_spec.rb b/spec/services/members/approve_access_request_service_spec.rb index 7076571b753..5c30f5b6a61 100644 --- a/spec/services/members/approve_access_request_service_spec.rb +++ b/spec/services/members/approve_access_request_service_spec.rb @@ -34,9 +34,9 @@ describe Members::ApproveAccessRequestService do context 'with a custom access level' do it 'returns a ProjectMember with the custom access level' do - member = described_class.new(current_user, access_level: Gitlab::Access::MASTER).execute(access_requester, opts) + member = described_class.new(current_user, access_level: Gitlab::Access::MAINTAINER).execute(access_requester, opts) - expect(member.access_level).to eq(Gitlab::Access::MASTER) + expect(member.access_level).to eq(Gitlab::Access::MAINTAINER) end end end @@ -97,7 +97,7 @@ describe Members::ApproveAccessRequestService do context 'when current user can approve access request to the project' do before do - project.add_master(current_user) + project.add_maintainer(current_user) group.add_owner(current_user) end diff --git a/spec/services/members/create_service_spec.rb b/spec/services/members/create_service_spec.rb index 1831c62d788..5c01463d757 100644 --- a/spec/services/members/create_service_spec.rb +++ b/spec/services/members/create_service_spec.rb @@ -6,7 +6,7 @@ describe Members::CreateService do let(:project_user) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) end it 'adds user to members' do diff --git a/spec/services/members/destroy_service_spec.rb b/spec/services/members/destroy_service_spec.rb index b4e9f6af43a..ef47b0a450b 100644 --- a/spec/services/members/destroy_service_spec.rb +++ b/spec/services/members/destroy_service_spec.rb @@ -114,7 +114,7 @@ describe Members::DestroyService do context 'when current user can destroy the given member' do before do - group_project.add_master(current_user) + group_project.add_maintainer(current_user) group.add_owner(current_user) end @@ -170,7 +170,7 @@ describe Members::DestroyService do context 'when current user can destroy the given access requester' do before do - group_project.add_master(current_user) + group_project.add_maintainer(current_user) group.add_owner(current_user) end @@ -210,7 +210,7 @@ describe Members::DestroyService do context 'when current user can destroy the given invited user' do before do - group_project.add_master(current_user) + group_project.add_maintainer(current_user) group.add_owner(current_user) end diff --git a/spec/services/members/update_service_spec.rb b/spec/services/members/update_service_spec.rb index a451272dd1f..6d19a95ffeb 100644 --- a/spec/services/members/update_service_spec.rb +++ b/spec/services/members/update_service_spec.rb @@ -8,7 +8,7 @@ describe Members::UpdateService do let(:permission) { :update } let(:member) { source.members_and_requesters.find_by!(user_id: member_user.id) } let(:params) do - { access_level: Gitlab::Access::MASTER } + { access_level: Gitlab::Access::MAINTAINER } end shared_examples 'a service raising Gitlab::Access::AccessDeniedError' do @@ -23,7 +23,7 @@ describe Members::UpdateService do updated_member = described_class.new(current_user, params).execute(member, permission: permission) expect(updated_member).to be_valid - expect(updated_member.access_level).to eq(Gitlab::Access::MASTER) + expect(updated_member.access_level).to eq(Gitlab::Access::MAINTAINER) end end @@ -44,7 +44,7 @@ describe Members::UpdateService do context 'when current user can update the given member' do before do - project.add_master(current_user) + project.add_maintainer(current_user) group.add_owner(current_user) end diff --git a/spec/services/merge_requests/close_service_spec.rb b/spec/services/merge_requests/close_service_spec.rb index 216e0cd4266..433ffbd97f0 100644 --- a/spec/services/merge_requests/close_service_spec.rb +++ b/spec/services/merge_requests/close_service_spec.rb @@ -9,7 +9,7 @@ describe MergeRequests::CloseService do let!(:todo) { create(:todo, :assigned, user: user, project: project, target: merge_request, author: user2) } before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user2) project.add_guest(guest) end diff --git a/spec/services/merge_requests/conflicts/list_service_spec.rb b/spec/services/merge_requests/conflicts/list_service_spec.rb index a5520e7373e..c81fa95e4b7 100644 --- a/spec/services/merge_requests/conflicts/list_service_spec.rb +++ b/spec/services/merge_requests/conflicts/list_service_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe MergeRequests::Conflicts::ListService do describe '#can_be_resolved_in_ui?' do - def create_merge_request(source_branch) - create(:merge_request, source_branch: source_branch, target_branch: 'conflict-start', merge_status: :unchecked) do |mr| + def create_merge_request(source_branch, target_branch = 'conflict-start') + create(:merge_request, source_branch: source_branch, target_branch: target_branch, merge_status: :unchecked) do |mr| mr.mark_as_unmergeable end end @@ -84,5 +84,11 @@ describe MergeRequests::Conflicts::ListService do expect(service.can_be_resolved_in_ui?).to be_falsey end + + it 'returns a falsey value when the conflict is in a submodule revision' do + merge_request = create_merge_request('update-gitlab-shell-v-6-0-3', 'update-gitlab-shell-v-6-0-1') + + expect(conflicts_service(merge_request).can_be_resolved_in_ui?).to be_falsey + end end end diff --git a/spec/services/merge_requests/create_service_spec.rb b/spec/services/merge_requests/create_service_spec.rb index 736a50b2c15..06fb61baf33 100644 --- a/spec/services/merge_requests/create_service_spec.rb +++ b/spec/services/merge_requests/create_service_spec.rb @@ -23,7 +23,7 @@ describe MergeRequests::CreateService do let(:merge_request) { service.execute } before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(assignee) allow(service).to receive(:execute_hooks) end @@ -185,8 +185,8 @@ describe MergeRequests::CreateService do end before do - project.add_master(user) - project.add_master(assignee) + project.add_maintainer(user) + project.add_maintainer(assignee) end it 'assigns and sets milestone to issuable from command' do @@ -202,7 +202,7 @@ describe MergeRequests::CreateService do let(:assignee) { create(:user) } before do - project.add_master(user) + project.add_maintainer(user) end it 'removes assignee_id when user id is invalid' do @@ -222,7 +222,7 @@ describe MergeRequests::CreateService do end it 'saves assignee when user id is valid' do - project.add_master(assignee) + project.add_maintainer(assignee) opts = { title: 'Title', description: 'Description', assignee_id: assignee.id } merge_request = described_class.new(project, user, opts).execute @@ -242,7 +242,7 @@ describe MergeRequests::CreateService do end it 'invalidates open merge request counter for assignees when merge request is assigned' do - project.add_master(assignee) + project.add_maintainer(assignee) described_class.new(project, user, opts).execute @@ -286,7 +286,7 @@ describe MergeRequests::CreateService do end before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(assignee) end @@ -316,7 +316,7 @@ describe MergeRequests::CreateService do context 'when user can not access source project' do before do target_project.add_developer(assignee) - target_project.add_master(user) + target_project.add_maintainer(user) end it 'raises an error' do @@ -328,7 +328,7 @@ describe MergeRequests::CreateService do context 'when user can not access target project' do before do target_project.add_developer(assignee) - target_project.add_master(user) + target_project.add_maintainer(user) end it 'raises an error' do @@ -372,7 +372,7 @@ describe MergeRequests::CreateService do before do project.add_developer(assignee) - project.add_master(user) + project.add_maintainer(user) end it 'ignores source_project_id' do diff --git a/spec/services/merge_requests/ff_merge_service_spec.rb b/spec/services/merge_requests/ff_merge_service_spec.rb index 28f56d19657..fe673de46aa 100644 --- a/spec/services/merge_requests/ff_merge_service_spec.rb +++ b/spec/services/merge_requests/ff_merge_service_spec.rb @@ -13,7 +13,7 @@ describe MergeRequests::FfMergeService do let(:project) { merge_request.project } before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user2) end diff --git a/spec/services/merge_requests/merge_service_spec.rb b/spec/services/merge_requests/merge_service_spec.rb index 33eea2cf5c3..9dd235f6660 100644 --- a/spec/services/merge_requests/merge_service_spec.rb +++ b/spec/services/merge_requests/merge_service_spec.rb @@ -7,7 +7,7 @@ describe MergeRequests::MergeService do let(:project) { merge_request.project } before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user2) end diff --git a/spec/services/merge_requests/post_merge_service_spec.rb b/spec/services/merge_requests/post_merge_service_spec.rb index 46e4e3559dc..ba2b062875b 100644 --- a/spec/services/merge_requests/post_merge_service_spec.rb +++ b/spec/services/merge_requests/post_merge_service_spec.rb @@ -6,7 +6,7 @@ describe MergeRequests::PostMergeService do let(:project) { merge_request.project } before do - project.add_master(user) + project.add_maintainer(user) end describe '#execute' do diff --git a/spec/services/merge_requests/rebase_service_spec.rb b/spec/services/merge_requests/rebase_service_spec.rb index 4daa25f8cf2..2703da7ae44 100644 --- a/spec/services/merge_requests/rebase_service_spec.rb +++ b/spec/services/merge_requests/rebase_service_spec.rb @@ -15,7 +15,7 @@ describe MergeRequests::RebaseService do subject(:service) { described_class.new(project, user, {}) } before do - project.add_master(user) + project.add_maintainer(user) end describe '#execute' do diff --git a/spec/services/merge_requests/reopen_service_spec.rb b/spec/services/merge_requests/reopen_service_spec.rb index 9ee37c51d95..e10eaa95da4 100644 --- a/spec/services/merge_requests/reopen_service_spec.rb +++ b/spec/services/merge_requests/reopen_service_spec.rb @@ -8,7 +8,7 @@ describe MergeRequests::ReopenService do let(:project) { merge_request.project } before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user2) project.add_guest(guest) end diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb index 443dcd92a8b..f0029af83cc 100644 --- a/spec/services/merge_requests/update_service_spec.rb +++ b/spec/services/merge_requests/update_service_spec.rb @@ -19,7 +19,7 @@ describe MergeRequests::UpdateService, :mailer do end before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user2) project.add_developer(user3) end diff --git a/spec/services/milestones/close_service_spec.rb b/spec/services/milestones/close_service_spec.rb index adad73f7e11..3f7a544ea0a 100644 --- a/spec/services/milestones/close_service_spec.rb +++ b/spec/services/milestones/close_service_spec.rb @@ -6,7 +6,7 @@ describe Milestones::CloseService do let(:milestone) { create(:milestone, title: "Milestone v1.2", project: project) } before do - project.add_master(user) + project.add_maintainer(user) end describe '#execute' do diff --git a/spec/services/milestones/create_service_spec.rb b/spec/services/milestones/create_service_spec.rb index f2a18c7295a..0c91112026f 100644 --- a/spec/services/milestones/create_service_spec.rb +++ b/spec/services/milestones/create_service_spec.rb @@ -7,7 +7,7 @@ describe Milestones::CreateService do describe '#execute' do context "valid params" do before do - project.add_master(user) + project.add_maintainer(user) opts = { title: 'v2.1.9', diff --git a/spec/services/milestones/destroy_service_spec.rb b/spec/services/milestones/destroy_service_spec.rb index 9703780b0e9..6f3612501f4 100644 --- a/spec/services/milestones/destroy_service_spec.rb +++ b/spec/services/milestones/destroy_service_spec.rb @@ -8,7 +8,7 @@ describe Milestones::DestroyService do let!(:merge_request) { create(:merge_request, source_project: project, milestone: milestone) } before do - project.add_master(user) + project.add_maintainer(user) end def service diff --git a/spec/services/milestones/promote_service_spec.rb b/spec/services/milestones/promote_service_spec.rb index a0a2843b676..df212d912e9 100644 --- a/spec/services/milestones/promote_service_spec.rb +++ b/spec/services/milestones/promote_service_spec.rb @@ -10,7 +10,7 @@ describe Milestones::PromoteService do describe '#execute' do before do - group.add_master(user) + group.add_maintainer(user) end context 'validations' do diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb index 2b2b983494f..0fd37c95e42 100644 --- a/spec/services/notes/create_service_spec.rb +++ b/spec/services/notes/create_service_spec.rb @@ -10,7 +10,7 @@ describe Notes::CreateService do describe '#execute' do before do - project.add_master(user) + project.add_maintainer(user) end context "valid params" do diff --git a/spec/services/notes/post_process_service_spec.rb b/spec/services/notes/post_process_service_spec.rb index 4e2ab919f0f..5aae0d711c3 100644 --- a/spec/services/notes/post_process_service_spec.rb +++ b/spec/services/notes/post_process_service_spec.rb @@ -7,7 +7,7 @@ describe Notes::PostProcessService do describe '#execute' do before do - project.add_master(user) + project.add_maintainer(user) note_opts = { note: 'Awesome comment', noteable_type: 'Issue', diff --git a/spec/services/notes/quick_actions_service_spec.rb b/spec/services/notes/quick_actions_service_spec.rb index b1e218821d2..784dac55454 100644 --- a/spec/services/notes/quick_actions_service_spec.rb +++ b/spec/services/notes/quick_actions_service_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe Notes::QuickActionsService do shared_context 'note on noteable' do let(:project) { create(:project) } - let(:master) { create(:user).tap { |u| project.add_master(u) } } + let(:maintainer) { create(:user).tap { |u| project.add_maintainer(u) } } let(:assignee) { create(:user) } before do - project.add_master(assignee) + project.add_maintainer(assignee) end end @@ -184,7 +184,7 @@ describe Notes::QuickActionsService do include_context 'note on noteable' it 'delegates to the class method' do - service = described_class.new(project, master) + service = described_class.new(project, maintainer) note = create(:note_on_issue, project: project) expect(described_class).to receive(:supported?).with(note) @@ -194,7 +194,7 @@ describe Notes::QuickActionsService do end describe '#execute' do - let(:service) { described_class.new(project, master) } + let(:service) { described_class.new(project, maintainer) } it_behaves_like 'note on noteable that supports quick actions' do let(:note) { build(:note_on_issue, project: project) } @@ -212,19 +212,19 @@ describe Notes::QuickActionsService do context 'CE restriction for issue assignees' do describe '/assign' do let(:project) { create(:project) } - let(:master) { create(:user).tap { |u| project.add_master(u) } } + let(:maintainer) { create(:user).tap { |u| project.add_maintainer(u) } } let(:assignee) { create(:user) } - let(:master) { create(:user) } - let(:service) { described_class.new(project, master) } + let(:maintainer) { create(:user) } + let(:service) { described_class.new(project, maintainer) } let(:note) { create(:note_on_issue, note: note_text, project: project) } let(:note_text) do - %(/assign @#{assignee.username} @#{master.username}\n") + %(/assign @#{assignee.username} @#{maintainer.username}\n") end before do - project.add_master(master) - project.add_master(assignee) + project.add_maintainer(maintainer) + project.add_maintainer(assignee) end it 'adds only one assignee from the list' do diff --git a/spec/services/notes/update_service_spec.rb b/spec/services/notes/update_service_spec.rb index 65b1d613998..533dcdcd6cd 100644 --- a/spec/services/notes/update_service_spec.rb +++ b/spec/services/notes/update_service_spec.rb @@ -9,7 +9,7 @@ describe Notes::UpdateService do let(:note) { create(:note, project: project, noteable: issue, author: user, note: "Old note #{user2.to_reference}") } before do - project.add_master(user) + project.add_maintainer(user) project.add_developer(user2) project.add_developer(user3) end diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index ab91176737d..c442f6fe32f 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -172,9 +172,9 @@ describe NotificationService, :mailer do before do build_team(note.project) - project.add_master(issue.author) - project.add_master(assignee) - project.add_master(note.author) + project.add_maintainer(issue.author) + project.add_maintainer(assignee) + project.add_maintainer(note.author) @u_custom_off = create_user_with_notification(:custom, 'custom_off') project.add_guest(@u_custom_off) @@ -255,8 +255,8 @@ describe NotificationService, :mailer do describe 'new note on issue in project that belongs to a group' do before do note.project.namespace_id = group.id - group.add_user(@u_watcher, GroupMember::MASTER) - group.add_user(@u_custom_global, GroupMember::MASTER) + group.add_user(@u_watcher, GroupMember::MAINTAINER) + group.add_user(@u_custom_global, GroupMember::MAINTAINER) note.project.save @u_watcher.notification_settings_for(note.project).participating! @@ -373,7 +373,7 @@ describe NotificationService, :mailer do before do build_team(note.project) build_group(note.project) - note.project.add_master(note.author) + note.project.add_maintainer(note.author) add_users_with_subscription(note.project, issue) reset_delivered_emails! end @@ -436,7 +436,7 @@ describe NotificationService, :mailer do project.add_guest(@u_guest_watcher) project.add_guest(@u_guest_custom) add_member_for_parent_group(@pg_watcher, project) - note.project.add_master(note.author) + note.project.add_maintainer(note.author) reset_delivered_emails! end @@ -577,8 +577,8 @@ describe NotificationService, :mailer do before do build_team(note.project) - project.add_master(merge_request.author) - project.add_master(merge_request.assignee) + project.add_maintainer(merge_request.author) + project.add_maintainer(merge_request.assignee) end describe '#new_note' do @@ -1088,8 +1088,8 @@ describe NotificationService, :mailer do let(:merge_request) { create :merge_request, source_project: project, assignee: create(:user), description: 'cc @participant' } before do - project.add_master(merge_request.author) - project.add_master(merge_request.assignee) + project.add_maintainer(merge_request.author) + project.add_maintainer(merge_request.assignee) build_team(merge_request.target_project) add_users_with_subscription(merge_request.target_project, merge_request) update_custom_notification(:new_merge_request, @u_guest_custom, resource: project) @@ -1529,13 +1529,13 @@ describe NotificationService, :mailer do let(:added_user) { create(:user) } describe '#new_access_request' do - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:owner) { create(:user) } let(:developer) { create(:user) } let!(:group) do create(:group, :public, :access_requestable) do |group| group.add_owner(owner) - group.add_master(master) + group.add_maintainer(maintainer) group.add_developer(developer) end end @@ -1544,11 +1544,11 @@ describe NotificationService, :mailer do reset_delivered_emails! end - it 'sends notification to group owners_and_masters' do + it 'sends notification to group owners_and_maintainers' do group.request_access(added_user) should_email(owner) - should_email(master) + should_email(maintainer) should_not_email(developer) end end @@ -1601,11 +1601,11 @@ describe NotificationService, :mailer do context 'for a project in a user namespace' do let(:project) do create(:project, :public, :access_requestable) do |project| - project.add_master(project.owner) + project.add_maintainer(project.owner) end end - it 'sends notification to project owners_and_masters' do + it 'sends notification to project owners_and_maintainers' do project.request_access(added_user) should_only_email(project.owner) @@ -1621,7 +1621,7 @@ describe NotificationService, :mailer do reset_delivered_emails! end - it 'sends notification to group owners_and_masters' do + it 'sends notification to group owners_and_maintainers' do project.request_access(added_user) should_only_email(group_owner) @@ -1759,11 +1759,11 @@ describe NotificationService, :mailer do end before do - project.add_master(u_member) - project.add_master(u_watcher) - project.add_master(u_custom_notification_unset) - project.add_master(u_custom_notification_enabled) - project.add_master(u_custom_notification_disabled) + project.add_maintainer(u_member) + project.add_maintainer(u_watcher) + project.add_maintainer(u_custom_notification_unset) + project.add_maintainer(u_custom_notification_enabled) + project.add_maintainer(u_custom_notification_disabled) reset_delivered_emails! end @@ -1903,15 +1903,15 @@ describe NotificationService, :mailer do set(:u_blocked) { create(:user, :blocked) } set(:u_silence) { create_user_with_notification(:disabled, 'silent', project) } set(:u_owner) { project.owner } - set(:u_master1) { create(:user) } - set(:u_master2) { create(:user) } + set(:u_maintainer1) { create(:user) } + set(:u_maintainer2) { create(:user) } set(:u_developer) { create(:user) } before do - project.add_master(u_blocked) - project.add_master(u_silence) - project.add_master(u_master1) - project.add_master(u_master2) + project.add_maintainer(u_blocked) + project.add_maintainer(u_silence) + project.add_maintainer(u_maintainer1) + project.add_maintainer(u_maintainer2) project.add_developer(u_developer) reset_delivered_emails! @@ -1926,12 +1926,12 @@ describe NotificationService, :mailer do describe "##{sym}" do subject(:notify!) { notification.send(sym, domain) } - it 'emails current watching masters' do + it 'emails current watching maintainers' do expect(Notify).to receive(:"#{sym}_email").at_least(:once).and_call_original notify! - should_only_email(u_master1, u_master2, u_owner) + should_only_email(u_maintainer1, u_maintainer2, u_owner) end it 'emails nobody if the project is missing' do @@ -1945,26 +1945,26 @@ describe NotificationService, :mailer do end describe '#pages_domain_verification_failed' do - it 'emails current watching masters' do + it 'emails current watching maintainers' do notification.pages_domain_verification_failed(domain) - should_only_email(u_master1, u_master2, u_owner) + should_only_email(u_maintainer1, u_maintainer2, u_owner) end end describe '#pages_domain_enabled' do - it 'emails current watching masters' do + it 'emails current watching maintainers' do notification.pages_domain_enabled(domain) - should_only_email(u_master1, u_master2, u_owner) + should_only_email(u_maintainer1, u_maintainer2, u_owner) end end describe '#pages_domain_disabled' do - it 'emails current watching masters' do + it 'emails current watching maintainers' do notification.pages_domain_disabled(domain) - should_only_email(u_master1, u_master2, u_owner) + should_only_email(u_maintainer1, u_maintainer2, u_owner) end end end @@ -1988,15 +1988,15 @@ describe NotificationService, :mailer do @u_guest_watcher = create_user_with_notification(:watch, 'guest_watching') @u_guest_custom = create_user_with_notification(:custom, 'guest_custom') - project.add_master(@u_watcher) - project.add_master(@u_participating) - project.add_master(@u_participant_mentioned) - project.add_master(@u_disabled) - project.add_master(@u_mentioned) - project.add_master(@u_committer) - project.add_master(@u_not_mentioned) - project.add_master(@u_lazy_participant) - project.add_master(@u_custom_global) + project.add_maintainer(@u_watcher) + project.add_maintainer(@u_participating) + project.add_maintainer(@u_participant_mentioned) + project.add_maintainer(@u_disabled) + project.add_maintainer(@u_mentioned) + project.add_maintainer(@u_committer) + project.add_maintainer(@u_not_mentioned) + project.add_maintainer(@u_lazy_participant) + project.add_maintainer(@u_custom_global) end # Users in the project's group but not part of project's team @@ -2011,7 +2011,7 @@ describe NotificationService, :mailer do # Group member: global=watch, group=global @g_global_watcher ||= create_global_setting_for(create(:user), :watch) - group.add_users([@g_watcher, @g_global_watcher], :master) + group.add_users([@g_watcher, @g_global_watcher], :maintainer) group end @@ -2050,7 +2050,7 @@ describe NotificationService, :mailer do project.reload - project.group.parent.add_master(user) + project.group.parent.add_maintainer(user) end def should_email_nested_group_user(user, times: 1, recipients: email_recipients) @@ -2072,11 +2072,11 @@ describe NotificationService, :mailer do @subscribed_participant = create_global_setting_for(create(:user, username: 'subscribed_participant'), :participating) @watcher_and_subscriber = create_global_setting_for(create(:user), :watch) - project.add_master(@subscribed_participant) - project.add_master(@subscriber) - project.add_master(@unsubscriber) - project.add_master(@watcher_and_subscriber) - project.add_master(@unsubscribed_mentioned) + project.add_maintainer(@subscribed_participant) + project.add_maintainer(@subscriber) + project.add_maintainer(@unsubscriber) + project.add_maintainer(@watcher_and_subscriber) + project.add_maintainer(@unsubscribed_mentioned) issuable.subscriptions.create(user: @unsubscribed_mentioned, project: project, subscribed: false) issuable.subscriptions.create(user: @subscriber, project: project, subscribed: true) diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index 4e4329e898e..fd69fe04053 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -23,7 +23,7 @@ describe Projects::CreateService, '#execute' do expect(project).to be_valid expect(project.owner).to eq(user) - expect(project.team.masters).to include(user) + expect(project.team.maintainers).to include(user) expect(project.namespace).to eq(user.namespace) end end @@ -47,7 +47,7 @@ describe Projects::CreateService, '#execute' do expect(project).to be_persisted expect(project.owner).to eq(user) - expect(project.team.masters).to contain_exactly(user) + expect(project.team.maintainers).to contain_exactly(user) expect(project.namespace).to eq(user.namespace) end end diff --git a/spec/services/projects/move_access_service_spec.rb b/spec/services/projects/move_access_service_spec.rb index a820ebd91f4..88d9d93c33b 100644 --- a/spec/services/projects/move_access_service_spec.rb +++ b/spec/services/projects/move_access_service_spec.rb @@ -4,18 +4,18 @@ describe Projects::MoveAccessService do let(:user) { create(:user) } let(:group) { create(:group) } let(:project_with_access) { create(:project, namespace: user.namespace) } - let(:master_user) { create(:user) } + let(:maintainer_user) { create(:user) } let(:reporter_user) { create(:user) } let(:developer_user) { create(:user) } - let(:master_group) { create(:group) } + let(:maintainer_group) { create(:group) } let(:reporter_group) { create(:group) } let(:developer_group) { create(:group) } before do - project_with_access.add_master(master_user) + project_with_access.add_maintainer(maintainer_user) project_with_access.add_developer(developer_user) project_with_access.add_reporter(reporter_user) - project_with_access.project_group_links.create(group: master_group, group_access: Gitlab::Access::MASTER) + project_with_access.project_group_links.create(group: maintainer_group, group_access: Gitlab::Access::MAINTAINER) project_with_access.project_group_links.create(group: developer_group, group_access: Gitlab::Access::DEVELOPER) project_with_access.project_group_links.create(group: reporter_group, group_access: Gitlab::Access::REPORTER) end @@ -87,7 +87,7 @@ describe Projects::MoveAccessService do let(:options) { { remove_remaining_elements: false } } it 'does not remove remaining memberships' do - target_project.add_master(master_user) + target_project.add_maintainer(maintainer_user) subject.execute(project_with_access, options) @@ -95,7 +95,7 @@ describe Projects::MoveAccessService do end it 'does not remove remaining group links' do - target_project.project_group_links.create(group: master_group, group_access: Gitlab::Access::MASTER) + target_project.project_group_links.create(group: maintainer_group, group_access: Gitlab::Access::MAINTAINER) subject.execute(project_with_access, options) diff --git a/spec/services/projects/move_project_authorizations_service_spec.rb b/spec/services/projects/move_project_authorizations_service_spec.rb index f7262b9b887..b4408393624 100644 --- a/spec/services/projects/move_project_authorizations_service_spec.rb +++ b/spec/services/projects/move_project_authorizations_service_spec.rb @@ -4,7 +4,7 @@ describe Projects::MoveProjectAuthorizationsService do let!(:user) { create(:user) } let(:project_with_users) { create(:project, namespace: user.namespace) } let(:target_project) { create(:project, namespace: user.namespace) } - let(:master_user) { create(:user) } + let(:maintainer_user) { create(:user) } let(:reporter_user) { create(:user) } let(:developer_user) { create(:user) } @@ -12,7 +12,7 @@ describe Projects::MoveProjectAuthorizationsService do describe '#execute' do before do - project_with_users.add_master(master_user) + project_with_users.add_maintainer(maintainer_user) project_with_users.add_developer(developer_user) project_with_users.add_reporter(reporter_user) end @@ -28,7 +28,7 @@ describe Projects::MoveProjectAuthorizationsService do end it 'does not move existent authorizations to the current project' do - target_project.add_master(developer_user) + target_project.add_maintainer(developer_user) target_project.add_developer(reporter_user) expect(project_with_users.authorized_users.count).to eq 4 @@ -44,7 +44,7 @@ describe Projects::MoveProjectAuthorizationsService do let(:options) { { remove_remaining_elements: false } } it 'does not remove remaining project authorizations' do - target_project.add_master(developer_user) + target_project.add_maintainer(developer_user) target_project.add_developer(reporter_user) subject.execute(project_with_users, options) diff --git a/spec/services/projects/move_project_group_links_service_spec.rb b/spec/services/projects/move_project_group_links_service_spec.rb index e3d06e6d3d7..7ca8cf304fe 100644 --- a/spec/services/projects/move_project_group_links_service_spec.rb +++ b/spec/services/projects/move_project_group_links_service_spec.rb @@ -4,7 +4,7 @@ describe Projects::MoveProjectGroupLinksService do let!(:user) { create(:user) } let(:project_with_groups) { create(:project, namespace: user.namespace) } let(:target_project) { create(:project, namespace: user.namespace) } - let(:master_group) { create(:group) } + let(:maintainer_group) { create(:group) } let(:reporter_group) { create(:group) } let(:developer_group) { create(:group) } @@ -12,7 +12,7 @@ describe Projects::MoveProjectGroupLinksService do describe '#execute' do before do - project_with_groups.project_group_links.create(group: master_group, group_access: Gitlab::Access::MASTER) + project_with_groups.project_group_links.create(group: maintainer_group, group_access: Gitlab::Access::MAINTAINER) project_with_groups.project_group_links.create(group: developer_group, group_access: Gitlab::Access::DEVELOPER) project_with_groups.project_group_links.create(group: reporter_group, group_access: Gitlab::Access::REPORTER) end @@ -28,7 +28,7 @@ describe Projects::MoveProjectGroupLinksService do end it 'does not move existent group links in the current project' do - target_project.project_group_links.create(group: master_group, group_access: Gitlab::Access::MASTER) + target_project.project_group_links.create(group: maintainer_group, group_access: Gitlab::Access::MAINTAINER) target_project.project_group_links.create(group: developer_group, group_access: Gitlab::Access::DEVELOPER) expect(project_with_groups.project_group_links.count).to eq 3 @@ -53,7 +53,7 @@ describe Projects::MoveProjectGroupLinksService do let(:options) { { remove_remaining_elements: false } } it 'does not remove remaining project group links' do - target_project.project_group_links.create(group: master_group, group_access: Gitlab::Access::MASTER) + target_project.project_group_links.create(group: maintainer_group, group_access: Gitlab::Access::MAINTAINER) target_project.project_group_links.create(group: developer_group, group_access: Gitlab::Access::DEVELOPER) subject.execute(project_with_groups, options) diff --git a/spec/services/projects/move_project_members_service_spec.rb b/spec/services/projects/move_project_members_service_spec.rb index 9c9a2d2fde1..c8c0eac1f13 100644 --- a/spec/services/projects/move_project_members_service_spec.rb +++ b/spec/services/projects/move_project_members_service_spec.rb @@ -4,7 +4,7 @@ describe Projects::MoveProjectMembersService do let!(:user) { create(:user) } let(:project_with_users) { create(:project, namespace: user.namespace) } let(:target_project) { create(:project, namespace: user.namespace) } - let(:master_user) { create(:user) } + let(:maintainer_user) { create(:user) } let(:reporter_user) { create(:user) } let(:developer_user) { create(:user) } @@ -12,7 +12,7 @@ describe Projects::MoveProjectMembersService do describe '#execute' do before do - project_with_users.add_master(master_user) + project_with_users.add_maintainer(maintainer_user) project_with_users.add_developer(developer_user) project_with_users.add_reporter(reporter_user) end @@ -28,7 +28,7 @@ describe Projects::MoveProjectMembersService do end it 'does not move existent members to the current project' do - target_project.add_master(developer_user) + target_project.add_maintainer(developer_user) target_project.add_developer(reporter_user) expect(project_with_users.project_members.count).to eq 4 @@ -53,7 +53,7 @@ describe Projects::MoveProjectMembersService do let(:options) { { remove_remaining_elements: false } } it 'does not remove remaining project members' do - target_project.add_master(developer_user) + target_project.add_maintainer(developer_user) target_project.add_developer(reporter_user) subject.execute(project_with_users, options) diff --git a/spec/services/projects/overwrite_project_service_spec.rb b/spec/services/projects/overwrite_project_service_spec.rb index 252c61f4224..c7900629f5f 100644 --- a/spec/services/projects/overwrite_project_service_spec.rb +++ b/spec/services/projects/overwrite_project_service_spec.rb @@ -96,10 +96,10 @@ describe Projects::OverwriteProjectService do context 'when project with elements' do it_behaves_like 'overwrite actions' do - let(:master_user) { create(:user) } + let(:maintainer_user) { create(:user) } let(:reporter_user) { create(:user) } let(:developer_user) { create(:user) } - let(:master_group) { create(:group) } + let(:maintainer_group) { create(:group) } let(:reporter_group) { create(:group) } let(:developer_group) { create(:group) } @@ -107,10 +107,10 @@ describe Projects::OverwriteProjectService do create_list(:deploy_keys_project, 2, project: project_from) create_list(:notification_setting, 2, source: project_from) create_list(:users_star_project, 2, project: project_from) - project_from.project_group_links.create(group: master_group, group_access: Gitlab::Access::MASTER) + project_from.project_group_links.create(group: maintainer_group, group_access: Gitlab::Access::MAINTAINER) project_from.project_group_links.create(group: developer_group, group_access: Gitlab::Access::DEVELOPER) project_from.project_group_links.create(group: reporter_group, group_access: Gitlab::Access::REPORTER) - project_from.add_master(master_user) + project_from.add_maintainer(maintainer_user) project_from.add_developer(developer_user) project_from.add_reporter(reporter_user) end diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb index 5100987c2fe..7e85f599afb 100644 --- a/spec/services/projects/transfer_service_spec.rb +++ b/spec/services/projects/transfer_service_spec.rb @@ -247,7 +247,7 @@ describe Projects::TransferService do let(:group_member) { create(:user) } before do - group.add_user(owner, GroupMember::MASTER) + group.add_user(owner, GroupMember::MAINTAINER) group.add_user(group_member, GroupMember::DEVELOPER) end diff --git a/spec/services/protected_branches/create_service_spec.rb b/spec/services/protected_branches/create_service_spec.rb index 786493c3577..79b744142c6 100644 --- a/spec/services/protected_branches/create_service_spec.rb +++ b/spec/services/protected_branches/create_service_spec.rb @@ -6,8 +6,8 @@ describe ProtectedBranches::CreateService do let(:params) do { name: 'master', - merge_access_levels_attributes: [{ access_level: Gitlab::Access::MASTER }], - push_access_levels_attributes: [{ access_level: Gitlab::Access::MASTER }] + merge_access_levels_attributes: [{ access_level: Gitlab::Access::MAINTAINER }], + push_access_levels_attributes: [{ access_level: Gitlab::Access::MAINTAINER }] } end @@ -16,8 +16,8 @@ describe ProtectedBranches::CreateService do it 'creates a new protected branch' do expect { service.execute }.to change(ProtectedBranch, :count).by(1) - expect(project.protected_branches.last.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER]) - expect(project.protected_branches.last.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER]) + expect(project.protected_branches.last.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MAINTAINER]) + expect(project.protected_branches.last.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MAINTAINER]) end context 'when user does not have permission' do diff --git a/spec/services/protected_tags/create_service_spec.rb b/spec/services/protected_tags/create_service_spec.rb index c3ed95aaebf..b16acf1d36c 100644 --- a/spec/services/protected_tags/create_service_spec.rb +++ b/spec/services/protected_tags/create_service_spec.rb @@ -6,7 +6,7 @@ describe ProtectedTags::CreateService do let(:params) do { name: 'master', - create_access_levels_attributes: [{ access_level: Gitlab::Access::MASTER }] + create_access_levels_attributes: [{ access_level: Gitlab::Access::MAINTAINER }] } end @@ -15,7 +15,7 @@ describe ProtectedTags::CreateService do it 'creates a new protected tag' do expect { service.execute }.to change(ProtectedTag, :count).by(1) - expect(project.protected_tags.last.create_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER]) + expect(project.protected_tags.last.create_access_levels.map(&:access_level)).to eq([Gitlab::Access::MAINTAINER]) end end end diff --git a/spec/services/search/global_service_spec.rb b/spec/services/search/global_service_spec.rb index d8dba26e194..980545b8083 100644 --- a/spec/services/search/global_service_spec.rb +++ b/spec/services/search/global_service_spec.rb @@ -10,7 +10,7 @@ describe Search::GlobalService do let!(:public_project) { create(:project, :public, name: 'searchable_public_project') } before do - found_project.add_master(user) + found_project.add_maintainer(user) end describe '#execute' do diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb index 02de83a2df8..e5e036c7d44 100644 --- a/spec/services/search_service_spec.rb +++ b/spec/services/search_service_spec.rb @@ -16,7 +16,7 @@ describe SearchService do let(:public_project) { create(:project, :public, name: 'public_project') } before do - accessible_project.add_master(user) + accessible_project.add_maintainer(user) end describe '#project' do diff --git a/spec/services/users/refresh_authorized_projects_service_spec.rb b/spec/services/users/refresh_authorized_projects_service_spec.rb index e5fde07a6eb..122b96ef216 100644 --- a/spec/services/users/refresh_authorized_projects_service_spec.rb +++ b/spec/services/users/refresh_authorized_projects_service_spec.rb @@ -30,10 +30,10 @@ describe Users::RefreshAuthorizedProjectsService do it 'updates the authorized projects of the user' do project2 = create(:project) to_remove = user.project_authorizations - .create!(project: project2, access_level: Gitlab::Access::MASTER) + .create!(project: project2, access_level: Gitlab::Access::MAINTAINER) expect(service).to receive(:update_authorizations) - .with([to_remove.project_id], [[user.id, project.id, Gitlab::Access::MASTER]]) + .with([to_remove.project_id], [[user.id, project.id, Gitlab::Access::MAINTAINER]]) service.execute_without_lease end @@ -45,7 +45,7 @@ describe Users::RefreshAuthorizedProjectsService do .create!(project: project, access_level: Gitlab::Access::DEVELOPER) expect(service).to receive(:update_authorizations) - .with([to_remove.project_id], [[user.id, project.id, Gitlab::Access::MASTER]]) + .with([to_remove.project_id], [[user.id, project.id, Gitlab::Access::MAINTAINER]]) service.execute_without_lease end @@ -76,14 +76,14 @@ describe Users::RefreshAuthorizedProjectsService do it 'inserts authorizations that should be added' do user.project_authorizations.delete_all - service.update_authorizations([], [[user.id, project.id, Gitlab::Access::MASTER]]) + service.update_authorizations([], [[user.id, project.id, Gitlab::Access::MAINTAINER]]) authorizations = user.project_authorizations expect(authorizations.length).to eq(1) expect(authorizations[0].user_id).to eq(user.id) expect(authorizations[0].project_id).to eq(project.id) - expect(authorizations[0].access_level).to eq(Gitlab::Access::MASTER) + expect(authorizations[0].access_level).to eq(Gitlab::Access::MAINTAINER) end end @@ -99,12 +99,12 @@ describe Users::RefreshAuthorizedProjectsService do end it 'sets the values to the access levels' do - expect(hash.values).to eq([Gitlab::Access::MASTER]) + expect(hash.values).to eq([Gitlab::Access::MAINTAINER]) end context 'personal projects' do it 'includes the project with the right access level' do - expect(hash[project.id]).to eq(Gitlab::Access::MASTER) + expect(hash[project.id]).to eq(Gitlab::Access::MAINTAINER) end end @@ -139,11 +139,11 @@ describe Users::RefreshAuthorizedProjectsService do let!(:other_project) { create(:project, group: nested_group) } before do - group.add_master(user) + group.add_maintainer(user) end it 'includes the project with the right access level' do - expect(hash[other_project.id]).to eq(Gitlab::Access::MASTER) + expect(hash[other_project.id]).to eq(Gitlab::Access::MAINTAINER) end end @@ -153,7 +153,7 @@ describe Users::RefreshAuthorizedProjectsService do let!(:project_group_link) { create(:project_group_link, project: other_project, group: group, group_access: Gitlab::Access::GUEST) } before do - group.add_master(user) + group.add_maintainer(user) end it 'includes the project with the right access level' do @@ -168,7 +168,7 @@ describe Users::RefreshAuthorizedProjectsService do let!(:project_group_link) { create(:project_group_link, project: other_project, group: nested_group, group_access: Gitlab::Access::DEVELOPER) } before do - group.add_master(user) + group.add_maintainer(user) end it 'includes the project with the right access level' do @@ -194,7 +194,7 @@ describe Users::RefreshAuthorizedProjectsService do value = hash.values[0] expect(value.project_id).to eq(project.id) - expect(value.access_level).to eq(Gitlab::Access::MASTER) + expect(value.access_level).to eq(Gitlab::Access::MAINTAINER) end end @@ -219,7 +219,7 @@ describe Users::RefreshAuthorizedProjectsService do end it 'includes the access level for every row' do - expect(row.access_level).to eq(Gitlab::Access::MASTER) + expect(row.access_level).to eq(Gitlab::Access::MAINTAINER) end end end @@ -235,7 +235,7 @@ describe Users::RefreshAuthorizedProjectsService do rows = service.fresh_authorizations.to_a expect(rows.length).to eq(1) - expect(rows.first.access_level).to eq(Gitlab::Access::MASTER) + expect(rows.first.access_level).to eq(Gitlab::Access::MAINTAINER) end context 'every returned row' do @@ -246,7 +246,7 @@ describe Users::RefreshAuthorizedProjectsService do end it 'includes the access level' do - expect(row.access_level).to eq(Gitlab::Access::MASTER) + expect(row.access_level).to eq(Gitlab::Access::MAINTAINER) end end end diff --git a/spec/support/features/issuable_slash_commands_shared_examples.rb b/spec/support/features/issuable_slash_commands_shared_examples.rb index 1bd6c25100e..9b44c532ff6 100644 --- a/spec/support/features/issuable_slash_commands_shared_examples.rb +++ b/spec/support/features/issuable_slash_commands_shared_examples.rb @@ -4,7 +4,7 @@ shared_examples 'issuable record that supports quick actions in its description and notes' do |issuable_type| include Spec::Support::Helpers::Features::NotesHelpers - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:project) do case issuable_type when :merge_request @@ -19,9 +19,9 @@ shared_examples 'issuable record that supports quick actions in its description let(:new_url_opts) { {} } before do - project.add_master(master) + project.add_maintainer(maintainer) - gitlab_sign_in(master) + gitlab_sign_in(maintainer) end after do @@ -210,31 +210,31 @@ shared_examples 'issuable record that supports quick actions in its description expect(page).not_to have_content '/todo' expect(page).to have_content 'Commands applied' - todos = TodosFinder.new(master).execute + todos = TodosFinder.new(maintainer).execute todo = todos.first expect(todos.size).to eq 1 expect(todo).to be_pending expect(todo.target).to eq issuable - expect(todo.author).to eq master - expect(todo.user).to eq master + expect(todo.author).to eq maintainer + expect(todo.user).to eq maintainer end end context "with a note marking the #{issuable_type} as done" do before do - TodoService.new.mark_todo(issuable, master) + TodoService.new.mark_todo(issuable, maintainer) end it "creates a new todo for the #{issuable_type}" do - todos = TodosFinder.new(master).execute + todos = TodosFinder.new(maintainer).execute todo = todos.first expect(todos.size).to eq 1 expect(todos.first).to be_pending expect(todo.target).to eq issuable - expect(todo.author).to eq master - expect(todo.user).to eq master + expect(todo.author).to eq maintainer + expect(todo.user).to eq maintainer add_note("/done") @@ -247,31 +247,31 @@ shared_examples 'issuable record that supports quick actions in its description context "with a note subscribing to the #{issuable_type}" do it "creates a new todo for the #{issuable_type}" do - expect(issuable.subscribed?(master, project)).to be_falsy + expect(issuable.subscribed?(maintainer, project)).to be_falsy add_note("/subscribe") expect(page).not_to have_content '/subscribe' expect(page).to have_content 'Commands applied' - expect(issuable.subscribed?(master, project)).to be_truthy + expect(issuable.subscribed?(maintainer, project)).to be_truthy end end context "with a note unsubscribing to the #{issuable_type} as done" do before do - issuable.subscribe(master, project) + issuable.subscribe(maintainer, project) end it "creates a new todo for the #{issuable_type}" do - expect(issuable.subscribed?(master, project)).to be_truthy + expect(issuable.subscribed?(maintainer, project)).to be_truthy add_note("/unsubscribe") expect(page).not_to have_content '/unsubscribe' expect(page).to have_content 'Commands applied' - expect(issuable.subscribed?(master, project)).to be_falsy + expect(issuable.subscribed?(maintainer, project)).to be_falsy end end @@ -282,7 +282,7 @@ shared_examples 'issuable record that supports quick actions in its description expect(page).not_to have_content '/assign me' expect(page).to have_content 'Commands applied' - expect(issuable.reload.assignees).to eq [master] + expect(issuable.reload.assignees).to eq [maintainer] end end end diff --git a/spec/support/helpers/markdown_feature.rb b/spec/support/helpers/markdown_feature.rb index 39e94ad53de..346f5b1cc4d 100644 --- a/spec/support/helpers/markdown_feature.rb +++ b/spec/support/helpers/markdown_feature.rb @@ -24,7 +24,7 @@ class MarkdownFeature def project @project ||= create(:project, :repository, group: group).tap do |project| - project.add_master(user) + project.add_maintainer(user) end end diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index 05a8e6206ae..e531495d917 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -49,7 +49,9 @@ module TestEnv 'add-pdf-file' => 'e774ebd', 'squash-large-files' => '54cec52', 'add-pdf-text-binary' => '79faa7b', - 'add_images_and_changes' => '010d106' + 'add_images_and_changes' => '010d106', + 'update-gitlab-shell-v-6-0-1' => '2f61d70', + 'update-gitlab-shell-v-6-0-3' => 'de78448' }.freeze # gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily diff --git a/spec/support/http_io/http_io_helpers.rb b/spec/support/http_io/http_io_helpers.rb index 2c68c2cd9a6..42144870eb5 100644 --- a/spec/support/http_io/http_io_helpers.rb +++ b/spec/support/http_io/http_io_helpers.rb @@ -1,65 +1,49 @@ module HttpIOHelpers - def stub_remote_trace_206 - WebMock.stub_request(:get, remote_trace_url) - .to_return { |request| remote_trace_response(request, 206) } + def stub_remote_url_206(url, file_path) + WebMock.stub_request(:get, url) + .to_return { |request| remote_url_response(file_path, request, 206) } end - def stub_remote_trace_200 - WebMock.stub_request(:get, remote_trace_url) - .to_return { |request| remote_trace_response(request, 200) } + def stub_remote_url_200(url, file_path) + WebMock.stub_request(:get, url) + .to_return { |request| remote_url_response(file_path, request, 200) } end - def stub_remote_trace_500 - WebMock.stub_request(:get, remote_trace_url) + def stub_remote_url_500(url) + WebMock.stub_request(:get, url) .to_return(status: [500, "Internal Server Error"]) end - def remote_trace_url - "http://trace.com/trace" - end - - def remote_trace_response(request, responce_status) + def remote_url_response(file_path, request, response_status) range = request.headers['Range'].match(/bytes=(\d+)-(\d+)/) + body = File.read(file_path).force_encoding(Encoding::BINARY) + size = body.bytesize + { - status: responce_status, - headers: remote_trace_response_headers(responce_status, range[1].to_i, range[2].to_i), - body: range_trace_body(range[1].to_i, range[2].to_i) + status: response_status, + headers: remote_url_response_headers(response_status, range[1].to_i, range[2].to_i, size), + body: body[range[1].to_i..range[2].to_i] } end - def remote_trace_response_headers(responce_status, from, to) - headers = { 'Content-Type' => 'text/plain' } - - if responce_status == 206 - headers.merge('Content-Range' => "bytes #{from}-#{to}/#{remote_trace_size}") + def remote_url_response_headers(response_status, from, to, size) + { 'Content-Type' => 'text/plain' }.tap do |headers| + if response_status == 206 + headers.merge('Content-Range' => "bytes #{from}-#{to}/#{size}") + end end - - headers - end - - def range_trace_body(from, to) - remote_trace_body[from..to] - end - - def remote_trace_body - @remote_trace_body ||= File.read(expand_fixture_path('trace/sample_trace')) - .force_encoding(Encoding::BINARY) - end - - def remote_trace_size - remote_trace_body.bytesize end def set_smaller_buffer_size_than(file_size) blocks = (file_size / 128) new_size = (blocks / 2) * 128 - stub_const("Gitlab::Ci::Trace::HttpIO::BUFFER_SIZE", new_size) + stub_const("Gitlab::HttpIO::BUFFER_SIZE", new_size) end def set_larger_buffer_size_than(file_size) blocks = (file_size / 128) new_size = (blocks * 2) * 128 - stub_const("Gitlab::Ci::Trace::HttpIO::BUFFER_SIZE", new_size) + stub_const("Gitlab::HttpIO::BUFFER_SIZE", new_size) end end diff --git a/spec/support/import_export/export_file_helper.rb b/spec/support/import_export/export_file_helper.rb index 562423afc2a..4d925ac77f4 100644 --- a/spec/support/import_export/export_file_helper.rb +++ b/spec/support/import_export/export_file_helper.rb @@ -37,7 +37,7 @@ module ExportFileHelper event = create(:event, :created, target: milestone, project: project, author: user, action: 5) create(:push_event_payload, event: event) - create(:project_member, :master, user: user, project: project) + create(:project_member, :maintainer, user: user, project: project) create(:ci_variable, project: project) create(:ci_trigger, project: project) key = create(:deploy_key) diff --git a/spec/support/matchers/access_matchers_for_controller.rb b/spec/support/matchers/access_matchers_for_controller.rb index 42a9ed9ff34..429401a5da8 100644 --- a/spec/support/matchers/access_matchers_for_controller.rb +++ b/spec/support/matchers/access_matchers_for_controller.rb @@ -24,7 +24,7 @@ module AccessMatchersForController when User user = role sign_in(user) - when *Gitlab::Access.sym_options_with_owner.keys # owner, master, developer, reporter, guest + when *Gitlab::Access.sym_options_with_owner.keys # owner, maintainer, developer, reporter, guest raise ArgumentError, "cannot emulate #{role} without membership parent" unless membership user = create_user_by_membership(role, membership) diff --git a/spec/support/services/issuable_create_service_slash_commands_shared_examples.rb b/spec/support/services/issuable_create_service_slash_commands_shared_examples.rb index 7b064162726..8b4cffaac19 100644 --- a/spec/support/services/issuable_create_service_slash_commands_shared_examples.rb +++ b/spec/support/services/issuable_create_service_slash_commands_shared_examples.rb @@ -3,7 +3,7 @@ shared_examples 'new issuable record that supports quick actions' do let!(:project) { create(:project, :repository) } - let(:user) { create(:user).tap { |u| project.add_master(u) } } + let(:user) { create(:user).tap { |u| project.add_maintainer(u) } } let(:assignee) { create(:user) } let!(:milestone) { create(:milestone, project: project) } let!(:labels) { create_list(:label, 3, project: project) } @@ -12,7 +12,7 @@ shared_examples 'new issuable record that supports quick actions' do let(:issuable) { described_class.new(project, user, params).execute } before do - project.add_master(assignee) + project.add_maintainer(assignee) end context 'with labels in command only' do diff --git a/spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb b/spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb index 5a569d233bc..7038a366144 100644 --- a/spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb +++ b/spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb @@ -10,9 +10,9 @@ RSpec.shared_examples 'a creatable merge request' do let!(:label2) { create(:label, project: target_project) } before do - source_project.add_master(user) - target_project.add_master(user) - target_project.add_master(user2) + source_project.add_maintainer(user) + target_project.add_maintainer(user) + target_project.add_maintainer(user2) sign_in(user) visit project_new_merge_request_path( diff --git a/spec/support/shared_examples/features/editable_merge_request_shared_examples.rb b/spec/support/shared_examples/features/editable_merge_request_shared_examples.rb index 645db41cddc..3057845061b 100644 --- a/spec/support/shared_examples/features/editable_merge_request_shared_examples.rb +++ b/spec/support/shared_examples/features/editable_merge_request_shared_examples.rb @@ -15,9 +15,9 @@ RSpec.shared_examples 'an editable merge request' do end before do - source_project.add_master(user) - target_project.add_master(user) - target_project.add_master(user2) + source_project.add_maintainer(user) + target_project.add_maintainer(user) + target_project.add_maintainer(user2) sign_in(user) visit edit_project_merge_request_path(target_project, merge_request) diff --git a/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb b/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb index b29bb3c2fc0..75ad948e42c 100644 --- a/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb +++ b/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb @@ -1,20 +1,20 @@ -RSpec.shared_examples 'Master manages access requests' do +RSpec.shared_examples 'Maintainer manages access requests' do let(:user) { create(:user) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } before do entity.request_access(user) - entity.respond_to?(:add_owner) ? entity.add_owner(master) : entity.add_master(master) - sign_in(master) + entity.respond_to?(:add_owner) ? entity.add_owner(maintainer) : entity.add_maintainer(maintainer) + sign_in(maintainer) end - it 'master can see access requests' do + it 'maintainer can see access requests' do visit members_page_path expect_visible_access_request(entity, user) end - it 'master can grant access', :js do + it 'maintainer can grant access', :js do visit members_page_path expect_visible_access_request(entity, user) @@ -28,7 +28,7 @@ RSpec.shared_examples 'Master manages access requests' do end end - it 'master can deny access', :js do + it 'maintainer can deny access', :js do visit members_page_path expect_visible_access_request(entity, user) diff --git a/spec/support/shared_examples/models/members_notifications_shared_example.rb b/spec/support/shared_examples/models/members_notifications_shared_example.rb index 76611e54306..ef5cea3f2a5 100644 --- a/spec/support/shared_examples/models/members_notifications_shared_example.rb +++ b/spec/support/shared_examples/models/members_notifications_shared_example.rb @@ -21,7 +21,7 @@ RSpec.shared_examples 'members notifications' do |entity_type| it "calls NotificationService.update_#{entity_type}_member" do expect(notification_service).to receive(:"update_#{entity_type}_member").with(member) - member.update_attribute(:access_level, Member::MASTER) + member.update_attribute(:access_level, Member::MAINTAINER) end it "does not send an email when the access level has not changed" do diff --git a/spec/uploaders/gitlab_uploader_spec.rb b/spec/uploaders/gitlab_uploader_spec.rb index 362f89424d4..44718ed1212 100644 --- a/spec/uploaders/gitlab_uploader_spec.rb +++ b/spec/uploaders/gitlab_uploader_spec.rb @@ -68,4 +68,66 @@ describe GitlabUploader do expect(subject.file.path).to match(/#{subject.cache_dir}/) end end + + describe '#open' do + context 'when trace is stored in File storage' do + context 'when file exists' do + let(:file) do + fixture_file_upload('spec/fixtures/trace/sample_trace', 'text/plain') + end + + before do + subject.store!(file) + end + + it 'returns io stream' do + expect(subject.open).to be_a(IO) + end + + it 'when passing block it yields' do + expect { |b| subject.open(&b) }.to yield_control + end + end + + context 'when file does not exist' do + it 'returns nil' do + expect(subject.open).to be_nil + end + + it 'when passing block it does not yield' do + expect { |b| subject.open(&b) }.not_to yield_control + end + end + end + + context 'when trace is stored in Object storage' do + before do + allow(subject).to receive(:file_storage?) { false } + end + + context 'when file exists' do + before do + allow(subject).to receive(:url) { 'http://object_storage.com/trace' } + end + + it 'returns http io stream' do + expect(subject.open).to be_a(Gitlab::HttpIO) + end + + it 'when passing block it yields' do + expect { |b| subject.open(&b) }.to yield_control.once + end + end + + context 'when file does not exist' do + it 'returns nil' do + expect(subject.open).to be_nil + end + + it 'when passing block it does not yield' do + expect { |b| subject.open(&b) }.not_to yield_control + end + end + end + end end diff --git a/spec/uploaders/job_artifact_uploader_spec.rb b/spec/uploaders/job_artifact_uploader_spec.rb index 026e4356ed6..3ad5fe7e3b3 100644 --- a/spec/uploaders/job_artifact_uploader_spec.rb +++ b/spec/uploaders/job_artifact_uploader_spec.rb @@ -23,43 +23,6 @@ describe JobArtifactUploader do store_dir: %r[\h{2}/\h{2}/\h{64}/\d{4}_\d{1,2}_\d{1,2}/\d+/\d+\z] end - describe '#open' do - subject { uploader.open } - - context 'when trace is stored in File storage' do - context 'when file exists' do - let(:file) do - fixture_file_upload('spec/fixtures/trace/sample_trace', 'text/plain') - end - - before do - uploader.store!(file) - end - - it 'returns io stream' do - is_expected.to be_a(IO) - end - end - - context 'when file does not exist' do - it 'returns nil' do - is_expected.to be_nil - end - end - end - - context 'when trace is stored in Object storage' do - before do - allow(uploader).to receive(:file_storage?) { false } - allow(uploader).to receive(:url) { 'http://object_storage.com/trace' } - end - - it 'returns http io stream' do - is_expected.to be_a(Gitlab::Ci::Trace::HttpIO) - end - end - end - context 'file is stored in valid local_path' do let(:file) do fixture_file_upload('spec/fixtures/ci_build_artifacts.zip', 'application/zip') diff --git a/spec/views/projects/imports/new.html.haml_spec.rb b/spec/views/projects/imports/new.html.haml_spec.rb index fc389641fcd..11fe144d1d2 100644 --- a/spec/views/projects/imports/new.html.haml_spec.rb +++ b/spec/views/projects/imports/new.html.haml_spec.rb @@ -9,7 +9,7 @@ describe "projects/imports/new.html.haml" do before do project.import_state.update(last_error: '<a href="http://googl.com">Foo</a>') sign_in(user) - project.add_master(user) + project.add_maintainer(user) end it "escapes HTML in import errors" do diff --git a/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb b/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb index 6e7d8db99c4..5d60d6bc5e7 100644 --- a/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb +++ b/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'projects/pipeline_schedules/_pipeline_schedule' do let(:owner) { create(:user) } - let(:master) { create(:user) } + let(:maintainer) { create(:user) } let(:project) { create(:project) } let(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project) } @@ -17,10 +17,10 @@ describe 'projects/pipeline_schedules/_pipeline_schedule' do context 'taking ownership of schedule' do context 'when non-owner is signed in' do - let(:user) { master } + let(:user) { maintainer } before do - allow(view).to receive(:can?).with(master, :take_ownership_pipeline_schedule, pipeline_schedule).and_return(true) + allow(view).to receive(:can?).with(maintainer, :take_ownership_pipeline_schedule, pipeline_schedule).and_return(true) end it 'non-owner can take ownership of pipeline' do diff --git a/spec/views/shared/notes/_form.html.haml_spec.rb b/spec/views/shared/notes/_form.html.haml_spec.rb index 50980718e66..c57319869f3 100644 --- a/spec/views/shared/notes/_form.html.haml_spec.rb +++ b/spec/views/shared/notes/_form.html.haml_spec.rb @@ -7,7 +7,7 @@ describe 'shared/notes/_form' do let(:project) { create(:project, :repository) } before do - project.add_master(user) + project.add_maintainer(user) assign(:project, project) assign(:note, note) diff --git a/spec/workers/git_garbage_collect_worker_spec.rb b/spec/workers/git_garbage_collect_worker_spec.rb index e39dec556fc..d5808e21271 100644 --- a/spec/workers/git_garbage_collect_worker_spec.rb +++ b/spec/workers/git_garbage_collect_worker_spec.rb @@ -27,6 +27,12 @@ describe GitGarbageCollectWorker do subject.perform(project.id, :gc, lease_key, lease_uuid) end + + it 'handles gRPC errors' do + expect_any_instance_of(Gitlab::GitalyClient::RepositoryService).to receive(:garbage_collect).and_raise(GRPC::NotFound) + + expect { subject.perform(project.id, :gc, lease_key, lease_uuid) }.to raise_exception(Gitlab::Git::Repository::NoRepository) + end end context 'with different lease than the active one' do diff --git a/spec/workers/merge_worker_spec.rb b/spec/workers/merge_worker_spec.rb index c861a56497e..b57c275c770 100644 --- a/spec/workers/merge_worker_spec.rb +++ b/spec/workers/merge_worker_spec.rb @@ -8,7 +8,7 @@ describe MergeWorker do let!(:author) { merge_request.author } before do - source_project.add_master(author) + source_project.add_maintainer(author) source_project.repository.expire_branches_cache end diff --git a/spec/workers/pipeline_schedule_worker_spec.rb b/spec/workers/pipeline_schedule_worker_spec.rb index e7a4ac0f3d6..a2fe4734d47 100644 --- a/spec/workers/pipeline_schedule_worker_spec.rb +++ b/spec/workers/pipeline_schedule_worker_spec.rb @@ -18,7 +18,7 @@ describe PipelineScheduleWorker do context 'when the schedule is runnable by the user' do before do - project.add_master(user) + project.add_maintainer(user) end context 'when there is a scheduled pipeline within next_run_at' do diff --git a/spec/workers/process_commit_worker_spec.rb b/spec/workers/process_commit_worker_spec.rb index ac79d9c0ac1..2d071c181c2 100644 --- a/spec/workers/process_commit_worker_spec.rb +++ b/spec/workers/process_commit_worker_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe ProcessCommitWorker do + include ProjectForksHelper + let(:worker) { described_class.new } let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } @@ -32,15 +34,41 @@ describe ProcessCommitWorker do worker.perform(project.id, user.id, commit.to_hash) end - context 'when commit already exists in upstream project' do - let(:forked) { create(:project, :public, :repository) } + context 'when the project is forked' do + context 'when commit already exists in the upstream project' do + it 'does not process the commit message' do + forked = fork_project(project, user, repository: true) + + expect(worker).not_to receive(:process_commit_message) + + worker.perform(forked.id, user.id, forked.commit.to_hash) + end + end + + context 'when the commit does not exist in the upstream project' do + it 'processes the commit message' do + empty_project = create(:project, :public) + forked = fork_project(empty_project, user, repository: true) + + TestEnv.copy_repo(forked, + bare_repo: TestEnv.factory_repo_path_bare, + refs: TestEnv::BRANCH_SHA) + + expect(worker).to receive(:process_commit_message) + + worker.perform(forked.id, user.id, forked.commit.to_hash) + end + end - it 'does not process commit message' do - create(:forked_project_link, forked_to_project: forked, forked_from_project: project) + context 'when the upstream project no longer exists' do + it 'processes the commit message' do + forked = fork_project(project, user, repository: true) + project.destroy! - expect(worker).not_to receive(:process_commit_message) + expect(worker).to receive(:process_commit_message) - worker.perform(forked.id, user.id, forked.commit.to_hash) + worker.perform(forked.id, user.id, forked.commit.to_hash) + end end end end |