diff options
author | Mark Chao <mchao@gitlab.com> | 2018-07-11 17:36:08 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-07-11 17:36:08 +0300 |
commit | a63bce1a4b55bc6cbafb9dec12d33028521489e9 (patch) | |
tree | ee9466e6b06536a65d4e851f4096679c6f968d1e /spec/requests/api/access_requests_spec.rb | |
parent | 1bf54e092783f7ad388225d32ab79ac1e845559c (diff) |
Resolve "Rename the `Master` role to `Maintainer`" Backend
Diffstat (limited to 'spec/requests/api/access_requests_spec.rb')
-rw-r--r-- | spec/requests/api/access_requests_spec.rb | 38 |
1 files changed, 19 insertions, 19 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 } |