Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c996b5e3
Commit
c996b5e3
authored
Oct 03, 2018
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature flag check in Namespace#feature_available?
parent
c81d2244
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
ee/app/models/ee/namespace.rb
ee/app/models/ee/namespace.rb
+3
-0
ee/spec/models/namespace_spec.rb
ee/spec/models/namespace_spec.rb
+16
-0
No files found.
ee/app/models/ee/namespace.rb
View file @
c996b5e3
...
@@ -72,6 +72,9 @@ module EE
...
@@ -72,6 +72,9 @@ module EE
# for a given Namespace plan. This method should consider ancestor groups
# for a given Namespace plan. This method should consider ancestor groups
# being licensed.
# being licensed.
def
feature_available?
(
feature
)
def
feature_available?
(
feature
)
# This feature might not be behind a feature flag at all, so default to true
return
false
unless
::
Feature
.
enabled?
(
feature
,
default_enabled:
true
)
available_features
=
strong_memoize
(
:feature_available
)
do
available_features
=
strong_memoize
(
:feature_available
)
do
Hash
.
new
do
|
h
,
feature
|
Hash
.
new
do
|
h
,
feature
|
h
[
feature
]
=
load_feature_available
(
feature
)
h
[
feature
]
=
load_feature_available
(
feature
)
...
...
ee/spec/models/namespace_spec.rb
View file @
c996b5e3
...
@@ -218,6 +218,22 @@ describe Namespace do
...
@@ -218,6 +218,22 @@ describe Namespace do
is_expected
.
to
be_falsy
is_expected
.
to
be_falsy
end
end
end
end
context
'when feature is disabled by a feature flag'
do
it
'returns false'
do
stub_feature_flags
(
feature
=>
false
)
is_expected
.
to
eq
(
false
)
end
end
context
'when feature is enabled by a feature flag'
do
it
'returns true'
do
stub_feature_flags
(
feature
=>
true
)
is_expected
.
to
eq
(
true
)
end
end
end
end
describe
'#max_active_pipelines'
do
describe
'#max_active_pipelines'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment