summaryrefslogtreecommitdiff
path: root/spec/models/project_feature_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/project_feature_spec.rb')
-rw-r--r--spec/models/project_feature_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/project_feature_spec.rb b/spec/models/project_feature_spec.rb
index 31e55bf6be6..84f13c44826 100644
--- a/spec/models/project_feature_spec.rb
+++ b/spec/models/project_feature_spec.rb
@@ -178,4 +178,28 @@ describe ProjectFeature do
it { is_expected.to eq(ProjectFeature::ENABLED) }
end
end
+
+ describe '.required_minimum_access_level' do
+ it 'handles reporter level' do
+ expect(described_class.required_minimum_access_level(:merge_requests)).to eq(Gitlab::Access::REPORTER)
+ end
+
+ it 'handles guest level' do
+ expect(described_class.required_minimum_access_level(:issues)).to eq(Gitlab::Access::GUEST)
+ end
+
+ it 'accepts ActiveModel' do
+ expect(described_class.required_minimum_access_level(MergeRequest)).to eq(Gitlab::Access::REPORTER)
+ end
+
+ it 'accepts string' do
+ expect(described_class.required_minimum_access_level('merge_requests')).to eq(Gitlab::Access::REPORTER)
+ end
+
+ it 'raises error if feature is invalid' do
+ expect do
+ described_class.required_minimum_access_level(:foos)
+ end.to raise_error
+ end
+ end
end