clean(spec): procedure_filters_spec.rb, less tdc by default
This commit is contained in:
parent
750842f742
commit
575c4cbdff
1 changed files with 31 additions and 21 deletions
|
@ -1,6 +1,7 @@
|
|||
describe "procedure filters" do
|
||||
let(:instructeur) { create(:instructeur) }
|
||||
let(:procedure) { create(:procedure, :published, types_de_champ_public: [{ type: :text }, { type: :departements }, { type: :regions }, { type: :drop_down_list }], instructeurs: [instructeur]) }
|
||||
let(:procedure) { create(:procedure, :published, types_de_champ_public:, instructeurs: [instructeur]) }
|
||||
let(:types_de_champ_public) { [{ type: :text }] }
|
||||
let!(:type_de_champ) { procedure.active_revision.types_de_champ_public.first }
|
||||
let!(:new_unfollow_dossier) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction)) }
|
||||
let!(:champ) { Champ.find_by(stable_id: type_de_champ.stable_id, dossier_id: new_unfollow_dossier.id) }
|
||||
|
@ -91,6 +92,8 @@ describe "procedure filters" do
|
|||
expect(page).to have_link(new_unfollow_dossier_2.user.email)
|
||||
end
|
||||
end
|
||||
describe 'with dropdown' do
|
||||
let(:types_de_champ_public) { [{ type: :drop_down_list }] }
|
||||
|
||||
scenario "should be able to user custom fiters", js: true do
|
||||
# use date filter
|
||||
|
@ -102,8 +105,11 @@ describe "procedure filters" do
|
|||
# use choice dropdown filter
|
||||
add_filter('Choix unique', 'val1', type: :enum)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with a vcr cached cassette' do
|
||||
describe 'departements' do
|
||||
let(:types_de_champ_public) { [{ type: :departements }] }
|
||||
scenario "should be able to find by departements with custom enum lookup", js: true do
|
||||
departement_champ = new_unfollow_dossier.champs.find(&:departement?)
|
||||
departement_champ.update!(value: 'Oise', external_id: '60')
|
||||
|
@ -113,7 +119,10 @@ describe "procedure filters" do
|
|||
add_filter(departement_champ.libelle, champ_select_value, type: :enum)
|
||||
expect(page).to have_link(new_unfollow_dossier.id.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'region' do
|
||||
let(:types_de_champ_public) { [{ type: :regions }] }
|
||||
scenario "should be able to find by region with custom enum lookup", js: true do
|
||||
region_champ = new_unfollow_dossier.champs.find(&:region?)
|
||||
region_champ.update!(value: 'Bretagne', external_id: '53')
|
||||
|
@ -123,6 +132,7 @@ describe "procedure filters" do
|
|||
expect(page).to have_link(new_unfollow_dossier.id.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scenario "should be able to add and remove two filters for the same field", js: true do
|
||||
add_filter(type_de_champ.libelle, champ.value)
|
||||
|
|
Loading…
Reference in a new issue