From cc80939a42cdfdaa4b5def40439820f46a8b7329 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 4 Jun 2019 15:08:28 +0200 Subject: [PATCH] spec: remove tests for old pj (probably) dead code --- .../add_type_de_piece_justificative_spec.rb | 77 ------------------- 1 file changed, 77 deletions(-) delete mode 100644 spec/features/admin/add_type_de_piece_justificative_spec.rb diff --git a/spec/features/admin/add_type_de_piece_justificative_spec.rb b/spec/features/admin/add_type_de_piece_justificative_spec.rb deleted file mode 100644 index 5c0ddc154..000000000 --- a/spec/features/admin/add_type_de_piece_justificative_spec.rb +++ /dev/null @@ -1,77 +0,0 @@ -require 'spec_helper' - -feature 'add a new type de piece justificative', js: true do - let(:administrateur) { create(:administrateur) } - - before do - login_as administrateur, scope: :administrateur - end - context 'when there is an existing piece justificative' do - let(:procedure) { create(:procedure, administrateur: administrateur) } - before do - # Create a dummy PJ, because adding PJs is no longer allowed on procedures that - # do not already have one - procedure.types_de_piece_justificative.create(libelle: "dummy PJ") - visit admin_procedure_pieces_justificatives_path(procedure) - end - scenario 'displays a form to add new type de piece justificative' do - within '#new_type_de_piece_justificative' do - expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_1_libelle') - end - end - context 'when user fills field and submit' do - let(:libelle) { 'ma piece' } - let(:description) { 'ma description' } - before do - page.find_by_id('procedure_types_de_piece_justificative_attributes_1_libelle').set(libelle) - page.find_by_id('procedure_types_de_piece_justificative_attributes_1_description').set(description) - page.click_on 'Ajouter la pièce' - wait_for_ajax - end - subject do - procedure.reload - procedure.types_de_piece_justificative.second - end - scenario 'creates new type de piece' do - expect(subject.libelle).to eq(libelle) - expect(subject.description).to eq(description) - end - scenario 'displays new created pj' do - within '#liste_piece_justificative' do - expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_1_libelle') - expect(page.body).to match(libelle) - expect(page.body).to match(description) - end - within '#new_type_de_piece_justificative' do - expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_2_libelle') - end - end - context 'when user delete pj' do - before do - pj = procedure.types_de_piece_justificative.second - page.find_by_id("delete_type_de_piece_justificative_#{pj.id}").click - wait_for_ajax - end - scenario 'removes pj from page' do - within '#liste_piece_justificative' do - expect(page).not_to have_css('#procedure_types_de_piece_justificative_attributes_1_libelle') - expect(page.body).not_to match(libelle) - expect(page.body).not_to match(description) - end - end - end - context 'when user change existing type de pj' do - let(:new_libelle) { 'mon nouveau libelle' } - before do - page.find_by_id('procedure_types_de_piece_justificative_attributes_1_libelle').set(new_libelle) - page.find_by_id('save').click - wait_for_ajax - end - scenario 'saves change in database' do - pj = procedure.types_de_piece_justificative.second - expect(pj.libelle).to eq(new_libelle) - end - end - end - end -end