Use Flipflop instead of Feature
This commit is contained in:
parent
7dd0611a28
commit
45019ce75c
22 changed files with 46 additions and 44 deletions
|
@ -2,19 +2,22 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe TypeDeChampHelper, type: :helper do
|
||||
describe ".tdc_options" do
|
||||
let(:current_administrateur) { create(:administrateur) }
|
||||
let(:pj_option) { ["Pièce justificative", "piece_justificative"] }
|
||||
|
||||
subject { tdc_options(current_administrateur) }
|
||||
subject { tdc_options }
|
||||
|
||||
context "when the champ_pj_allowed_for_admin_id matches the current_administrateur's id" do
|
||||
before { allow(Features).to receive(:champ_pj_allowed_for_admin_ids).and_return([current_administrateur.id]) }
|
||||
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_allowed_for_admin_id does not match the current_administrateur's id" do
|
||||
before { allow(Features).to receive(:champ_pj_allowed_for_admin_ids).and_return([1000]) }
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue