Commit 1c6710c2 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents a5f50a52 cfb7f116
This diff is collapsed.
...@@ -82,6 +82,13 @@ class Feature ...@@ -82,6 +82,13 @@ class Feature
get(key).disable_group(group) get(key).disable_group(group)
end end
def remove(key)
feature = get(key)
return unless persisted?(feature)
feature.remove
end
def flipper def flipper
if Gitlab::SafeRequestStore.active? if Gitlab::SafeRequestStore.active?
Gitlab::SafeRequestStore[:flipper] ||= build_flipper_instance Gitlab::SafeRequestStore[:flipper] ||= build_flipper_instance
......
...@@ -254,6 +254,22 @@ describe Feature do ...@@ -254,6 +254,22 @@ describe Feature do
end end
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 Feature::Target do
describe '#targets' do describe '#targets' do
let(:project) { create(:project) } let(:project) { create(:project) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment