diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/policies/concerns/crud_policy_helpers_spec.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/policies/concerns/crud_policy_helpers_spec.rb')
-rw-r--r-- | spec/policies/concerns/crud_policy_helpers_spec.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/policies/concerns/crud_policy_helpers_spec.rb b/spec/policies/concerns/crud_policy_helpers_spec.rb new file mode 100644 index 00000000000..69bf9ad12d6 --- /dev/null +++ b/spec/policies/concerns/crud_policy_helpers_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe CrudPolicyHelpers do + let(:policy_test_class) do + Class.new do + include CrudPolicyHelpers + end + end + + let(:feature_name) { :foo } + + before do + stub_const('PolicyTestClass', policy_test_class) + end + + describe '.create_read_update_admin_destroy' do + it 'returns an array of the appropriate abilites given a feature name' do + expect(PolicyTestClass.create_read_update_admin_destroy(feature_name)).to eq([ + :read_foo, + :create_foo, + :update_foo, + :admin_foo, + :destroy_foo + ]) + end + end + + describe '.create_update_admin_destroy' do + it 'returns an array of the appropriate abilites given a feature name' do + expect(PolicyTestClass.create_update_admin_destroy(feature_name)).to eq([ + :create_foo, + :update_foo, + :admin_foo, + :destroy_foo + ]) + end + end + + describe '.create_update_admin' do + it 'returns an array of the appropriate abilites given a feature name' do + expect(PolicyTestClass.create_update_admin(feature_name)).to eq([ + :create_foo, + :update_foo, + :admin_foo + ]) + end + end +end |