feat: enable features on cloned procedure
This commit is contained in:
parent
fce2d8efa9
commit
c4ca381bed
2 changed files with 28 additions and 0 deletions
|
@ -539,6 +539,12 @@ class Procedure < ApplicationRecord
|
||||||
.find_by(label: defaut_groupe_instructeur.label) || procedure.groupe_instructeurs.first
|
.find_by(label: defaut_groupe_instructeur.label) || procedure.groupe_instructeurs.first
|
||||||
procedure.update!(defaut_groupe_instructeur: new_defaut_groupe)
|
procedure.update!(defaut_groupe_instructeur: new_defaut_groupe)
|
||||||
|
|
||||||
|
Flipper.features.each do |feature|
|
||||||
|
if feature_enabled?(feature.key)
|
||||||
|
Flipper.enable(feature.key, procedure)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
procedure
|
procedure
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -847,6 +847,28 @@ describe Procedure do
|
||||||
expect(subject.canonical_procedure).to be_nil
|
expect(subject.canonical_procedure).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'feature flag' do
|
||||||
|
context 'with a feature flag enabled' do
|
||||||
|
before do
|
||||||
|
Flipper.enable(:procedure_routage_api, procedure)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should enable feature' do
|
||||||
|
expect(subject.feature_enabled?(:procedure_routage_api)).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with a feature flag disabled' do
|
||||||
|
before do
|
||||||
|
Flipper.disable(:procedure_routage_api, procedure)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not enable feature' do
|
||||||
|
expect(subject.feature_enabled?(:procedure_routage_api)).to be false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#publish!' do
|
describe '#publish!' do
|
||||||
|
|
Loading…
Reference in a new issue