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/policies | |
parent | 1bf54e092783f7ad388225d32ab79ac1e845559c (diff) |
Resolve "Rename the `Master` role to `Maintainer`" Backend
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/ci/build_policy_spec.rb | 10 | ||||
-rw-r--r-- | spec/policies/ci/pipeline_schedule_policy_spec.rb | 8 | ||||
-rw-r--r-- | spec/policies/ci/trigger_policy_spec.rb | 12 | ||||
-rw-r--r-- | spec/policies/clusters/cluster_policy_spec.rb | 4 | ||||
-rw-r--r-- | spec/policies/deploy_key_policy_spec.rb | 2 | ||||
-rw-r--r-- | spec/policies/deploy_token_policy_spec.rb | 12 | ||||
-rw-r--r-- | spec/policies/environment_policy_spec.rb | 20 | ||||
-rw-r--r-- | spec/policies/global_policy_spec.rb | 4 | ||||
-rw-r--r-- | spec/policies/group_policy_spec.rb | 42 | ||||
-rw-r--r-- | spec/policies/project_policy_spec.rb | 30 | ||||
-rw-r--r-- | spec/policies/protected_branch_policy_spec.rb | 4 |
11 files changed, 74 insertions, 74 deletions
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 3728218accc..0442b032e89 100644 --- a/spec/policies/environment_policy_spec.rb +++ b/spec/policies/environment_policy_spec.rb @@ -17,11 +17,11 @@ describe EnvironmentPolicy do end where(:access_level, :allowed?) do - nil | false - :guest | false - :reporter | false - :developer | true - :master | true + nil | false + :guest | false + :reporter | false + :developer | true + :maintainer | true end with_them do @@ -63,11 +63,11 @@ describe EnvironmentPolicy do end where(:access_level, :allowed?) do - nil | false - :guest | false - :reporter | false - :developer | false - :master | true + nil | false + :guest | false + :reporter | false + :developer | false + :maintainer | true end with_them do 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 |