Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-09-21 23:43:24 +0300
committerRobert Speicher <rspeicher@gmail.com>2018-10-04 22:08:21 +0300
commit939467885851eb0f3fc5bcbaab6cb585bb85710d (patch)
tree62b9b391f8d1a8c0bf9e3a780298ab2301e36a45 /spec/models/project_feature_spec.rb
parent1973d0c183218e7ca826d627eaea5ce91a17bed3 (diff)
Add ProjectFeature check for feature flag
This will allow an explicitly-disabled feature flag to override a feature being available for a project. As an extreme example, we could quickly disable issues across all projects at runtime by running `Feature.disable(:issues)`.
Diffstat (limited to 'spec/models/project_feature_spec.rb')
-rw-r--r--spec/models/project_feature_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/project_feature_spec.rb b/spec/models/project_feature_spec.rb
index cd7f77024da..2a193864e46 100644
--- a/spec/models/project_feature_spec.rb
+++ b/spec/models/project_feature_spec.rb
@@ -73,6 +73,22 @@ describe ProjectFeature do
end
end
end
+
+ context 'when feature is disabled by a feature flag' do
+ it 'returns false' do
+ stub_feature_flags(issues: false)
+
+ expect(project.feature_available?(:issues, user)).to eq(false)
+ end
+ end
+
+ context 'when feature is enabled by a feature flag' do
+ it 'returns true' do
+ stub_feature_flags(issues: true)
+
+ expect(project.feature_available?(:issues, user)).to eq(true)
+ end
+ end
end
context 'repository related features' do