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
31e419e9
Commit
31e419e9
authored
Jul 31, 2019
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new Feature.remove method
parent
a4e08446
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
lib/feature.rb
lib/feature.rb
+7
-0
spec/lib/feature_spec.rb
spec/lib/feature_spec.rb
+16
-0
No files found.
lib/feature.rb
View file @
31e419e9
...
...
@@ -80,6 +80,13 @@ class Feature
get
(
key
).
disable_group
(
group
)
end
def
remove
(
key
)
feature
=
get
(
key
)
return
unless
persisted?
(
feature
)
feature
.
remove
end
def
flipper
if
Gitlab
::
SafeRequestStore
.
active?
Gitlab
::
SafeRequestStore
[
:flipper
]
||=
build_flipper_instance
...
...
spec/lib/feature_spec.rb
View file @
31e419e9
...
...
@@ -254,6 +254,22 @@ describe Feature do
end
end
describe
'.remove'
do
context
'for a non-persisted feature'
do
it
'returns nil'
do
expect
(
described_class
.
remove
(
:non_persisted_feature_flag
)).
to
be_nil
end
end
context
'for a persisted feature'
do
it
'returns true'
do
described_class
.
enable
(
:persisted_feature_flag
)
expect
(
described_class
.
remove
(
:persisted_feature_flag
)).
to
be_truthy
end
end
end
describe
Feature
::
Target
do
describe
'#targets'
do
let
(
:project
)
{
create
(
:project
)
}
...
...
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