Make champ PJ generally available

This commit is contained in:
Frederic Merizen 2018-12-10 19:47:52 +01:00
parent 64d32c6afc
commit 57a136c861
5 changed files with 12 additions and 22 deletions

View file

@ -2,7 +2,6 @@ class TypesDeChampService
include Rails.application.routes.url_helpers
TOGGLES = {
TypeDeChamp.type_champs.fetch(:piece_justificative) => :champ_pj?,
TypeDeChamp.type_champs.fetch(:siret) => :champ_siret?,
TypeDeChamp.type_champs.fetch(:integer_number) => :champ_integer_number?
}

View file

@ -7,8 +7,6 @@ Flipflop.configure do
strategy :default
group :champs do
feature :champ_pj,
title: "Champ pièce justificative"
feature :champ_siret,
title: "Champ SIRET"
feature :champ_integer_number,
@ -28,4 +26,12 @@ Flipflop.configure do
feature :pre_maintenance_mode
feature :maintenance_mode
end
if Rails.env.test?
# It would be nicer to configure this in administrateur_spec.rb in #feature_enabled?,
# but that results in a FrozenError: can't modify frozen Hash
feature :test_a
feature :test_b
end
end

View file

@ -4,7 +4,6 @@ namespace :'2018_05_21_cerfa_to_pj' do
dossiers.group_by(&:procedure).each do |procedure, dossiers|
if !procedure.types_de_champ.find_by(libelle: 'CERFA')
procedure.administrateur.enable_feature(:champ_pj)
type_de_champ = procedure.types_de_champ.create(
type_champ: 'piece_justificative',
libelle: 'CERFA'

View file

@ -65,11 +65,11 @@ describe Administrateur, type: :model do
let(:administrateur) { create(:administrateur) }
before do
administrateur.enable_feature(:champ_pj)
administrateur.enable_feature(:test_a)
end
it { expect(administrateur.feature_enabled?(:champ_siret)).to be_falsey }
it { expect(administrateur.feature_enabled?(:champ_pj)).to be_truthy }
it { expect(administrateur.feature_enabled?(:test_b)).to be_falsey }
it { expect(administrateur.feature_enabled?(:test_a)).to be_truthy }
end
describe "#password_complexity" do

View file

@ -107,20 +107,6 @@ describe TypesDeChampService do
subject { service.options }
context "when the champ_pj is enabled" do
before do
Flipflop::FeatureSet.current.test!.switch!(:champ_pj, true)
end
it { is_expected.to include(pj_option) }
end
context "when the champ_pj is disabled" do
before do
Flipflop::FeatureSet.current.test!.switch!(:champ_pj, false)
end
it { is_expected.not_to include(pj_option) }
end
it { is_expected.to include(pj_option) }
end
end