refresh list of pj when adding new one

This commit is contained in:
Tanguy PATTE 2015-11-20 14:17:38 +01:00
parent bcf712828e
commit bd5dc1e35a
5 changed files with 38 additions and 23 deletions

View file

@ -12,7 +12,9 @@ feature 'add a new type de piece justificative', js: true do
visit admin_procedure_pieces_justificatives_path(procedure)
end
scenario 'displays a form to add new type de piece justificative' do
expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_0_libelle')
within '#new_type_de_piece_justificative' do
expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_0_libelle')
end
end
context 'when user fills field and submit' do
let(:libelle) { 'ma piece' }
@ -31,6 +33,16 @@ feature 'add a new type de piece justificative', js: true 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_0_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_1_libelle')
end
end
end
end
end