diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
commit | be834a25982746ffd85252ff502df42bb88cb9d5 (patch) | |
tree | b4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /spec/policies/design_management/design_policy_spec.rb | |
parent | ee925a3597f27e92f83a50937a64068109675b3d (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
Diffstat (limited to 'spec/policies/design_management/design_policy_spec.rb')
-rw-r--r-- | spec/policies/design_management/design_policy_spec.rb | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/spec/policies/design_management/design_policy_spec.rb b/spec/policies/design_management/design_policy_spec.rb index 5a74d979ef3..117279d1638 100644 --- a/spec/policies/design_management/design_policy_spec.rb +++ b/spec/policies/design_management/design_policy_spec.rb @@ -71,6 +71,11 @@ RSpec.describe DesignManagement::DesignPolicy do end end + shared_examples_for "read-only design abilities" do + it { is_expected.to be_allowed(*guest_design_abilities) } + it { is_expected.to be_disallowed(*developer_design_abilities) } + end + shared_examples_for "design abilities available for members" do context "for owners" do let(:current_user) { owner } @@ -86,8 +91,7 @@ RSpec.describe DesignManagement::DesignPolicy do end context "when admin mode disabled" do - it { is_expected.to be_allowed(*guest_design_abilities) } - it { is_expected.to be_disallowed(*developer_design_abilities) } + it_behaves_like "read-only design abilities" end end @@ -106,16 +110,10 @@ RSpec.describe DesignManagement::DesignPolicy do context "for reporters" do let(:current_user) { reporter } - it { is_expected.to be_allowed(*guest_design_abilities) } - it { is_expected.to be_disallowed(*developer_design_abilities) } + it_behaves_like "read-only design abilities" end end - shared_examples_for "read-only design abilities" do - it { is_expected.to be_allowed(:read_design) } - it { is_expected.to be_disallowed(:create_design, :destroy_design) } - end - context "when DesignManagement is not enabled" do before do enable_design_management(false) @@ -135,15 +133,13 @@ RSpec.describe DesignManagement::DesignPolicy do let_it_be(:project) { create(:project, :private) } let(:current_user) { guest } - it { is_expected.to be_allowed(*guest_design_abilities) } - it { is_expected.to be_disallowed(*developer_design_abilities) } + it_behaves_like "read-only design abilities" end context "for anonymous users in public projects" do let(:current_user) { nil } - it { is_expected.to be_allowed(*guest_design_abilities) } - it { is_expected.to be_disallowed(*developer_design_abilities) } + it_behaves_like "read-only design abilities" end context "when the issue is confidential" do @@ -164,20 +160,6 @@ RSpec.describe DesignManagement::DesignPolicy do end end - context "when the issue is locked" do - let_it_be(:issue) { create(:issue, :locked, project: project) } - let(:current_user) { owner } - - it_behaves_like "read-only design abilities" - end - - context "when the issue has moved" do - let_it_be(:issue) { create(:issue, project: project, moved_to: create(:issue)) } - let(:current_user) { owner } - - it_behaves_like "read-only design abilities" - end - context "when the project is archived" do let_it_be(:project) { create(:project, :public, :archived) } let_it_be(:issue) { create(:issue, project: project) } |