diff options
Diffstat (limited to 'spec/requests')
32 files changed, 254 insertions, 254 deletions
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 5a04e699d60..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 @@ -734,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 @@ -812,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 0609166ed90..7d1a5c12805 100644 --- a/spec/requests/api/jobs_spec.rb +++ b/spec/requests/api/jobs_spec.rb @@ -645,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/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 15da81b57db..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 @@ -1542,7 +1542,7 @@ describe API::Projects do 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 eb57c734e92..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 @@ -576,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) @@ -589,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 |