add feature flag

This commit is contained in:
simon lehericey 2022-07-12 10:43:40 +02:00
parent c4c0c275e1
commit 9bd1d97ed7
3 changed files with 13 additions and 1 deletions

View file

@ -201,7 +201,11 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent
end
def render?
@condition.present? || available_targets_for_select.any?
if Flipper.enabled?(:conditional, controller.current_user)
@condition.present? || available_targets_for_select.any?
else
false
end
end
def input_name_for(name)

View file

@ -1,6 +1,12 @@
describe TypesDeChampEditor::ConditionsComponent, type: :component do
include Logic
# TODO: remove along with feature flipping
before do
allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(nil)
allow(Flipper).to receive(:enabled?).with(:conditional, anything).and_return(true)
end
describe 'render' do
let(:tdc) { create(:type_de_champ, condition: condition) }
let(:condition) { nil }

View file

@ -17,6 +17,8 @@ describe 'As an administrateur I can edit types de champ condition', js: true do
before do
login_as administrateur.user, scope: :user
# TODO: remove along with feature flipping
allow(Flipper).to receive(:enabled?).with(:conditional, anything).and_return(true)
visit champs_admin_procedure_path(procedure)
end