fix specs

This commit is contained in:
Lisa Durand 2023-05-31 17:04:21 +02:00
parent 6b1c80ebc9
commit 4fdcce45c5
7 changed files with 4 additions and 29 deletions

View file

@ -103,7 +103,7 @@
selected: @procedure.tags, selected: @procedure.tags,
disabled: [], disabled: [],
label: 'Tags', label: 'Tags',
group: '.procedure-form__column--form', group: '.procedure_tags_combo',
name: 'tags', name: 'tags',
describedby: 'procedure-tags', describedby: 'procedure-tags',
acceptNewValues: true) acceptNewValues: true)

View file

@ -8,7 +8,7 @@
= render NestedForms::FormOwnerComponent.new = render NestedForms::FormOwnerComponent.new
= form_for @procedure, = form_for @procedure,
url: url_for({ controller: 'administrateurs/procedures', action: :update, id: @procedure.id }), url: url_for({ controller: 'administrateurs/procedures', action: :update, id: @procedure.id }),
html: { class: 'form', multipart: true } do |f| html: { class: 'form procedure_tags_combo', multipart: true } do |f|
.fr-container .fr-container
.fr-grid-row .fr-grid-row
.fr-col-12.fr-col-offset-sm-2.fr-col-sm-8 .fr-col-12.fr-col-offset-sm-2.fr-col-sm-8

View file

@ -7,7 +7,7 @@
= render NestedForms::FormOwnerComponent.new = render NestedForms::FormOwnerComponent.new
= form_for @procedure, = form_for @procedure,
url: url_for({ controller: 'administrateurs/procedures', action: :create, id: @procedure.id }), url: url_for({ controller: 'administrateurs/procedures', action: :create, id: @procedure.id }),
html: { class: 'form', multipart: true } do |f| html: { class: 'form procedure_tags_combo', multipart: true } do |f|
.fr-container .fr-container
.fr-grid-row .fr-grid-row
.fr-col-12.fr-col-offset-sm-2.fr-col-sm-8 .fr-col-12.fr-col-offset-sm-2.fr-col-sm-8

View file

@ -41,14 +41,6 @@ describe 'Creating a new procedure', js: true do
add_champ add_champ
expect(page).to have_selector('.type-de-champ', count: 1) expect(page).to have_selector('.type-de-champ', count: 1)
click_on Procedure.last.libelle
preview_window = window_opened_by { find('#preview-procedure').click }
within_window(preview_window) do
expect(page).to have_current_path(apercu_admin_procedure_path(Procedure.last))
expect(page).to have_field('libelle de champ')
end
end end
scenario 'a warning is displayed when creating an invalid procedure' do scenario 'a warning is displayed when creating an invalid procedure' do

View file

@ -44,7 +44,6 @@ describe 'Publishing a procedure', js: true do
click_on 'Publier' click_on 'Publier'
expect(page).to have_text('Démarche publiée') expect(page).to have_text('Démarche publiée')
expect(page).to have_selector('#preview-procedure')
end end
context 'when the procedure has invalid champs' do context 'when the procedure has invalid champs' do
@ -93,7 +92,6 @@ describe 'Publishing a procedure', js: true do
click_on 'publish' click_on 'publish'
expect(page).to have_text('Démarche publiée') expect(page).to have_text('Démarche publiée')
expect(page).to have_selector('#preview-procedure')
end end
end end
@ -125,7 +123,6 @@ describe 'Publishing a procedure', js: true do
find('#publish').click find('#publish').click
expect(page).to have_text('Démarche publiée') expect(page).to have_text('Démarche publiée')
expect(page).to have_selector('#preview-procedure')
end end
end end

View file

@ -32,10 +32,6 @@ describe 'Administrateurs can edit procedures', js: true do
expect(page).to have_field('procedure_libelle', with: procedure.libelle) expect(page).to have_field('procedure_libelle', with: procedure.libelle)
fill_in('procedure_libelle', with: 'Ma petite démarche') fill_in('procedure_libelle', with: 'Ma petite démarche')
within('.procedure-form__preview') do
expect(page).to have_content('Ma petite démarche')
end
click_on 'Enregistrer' click_on 'Enregistrer'
expect(page).to have_selector('.fr-breadcrumb li', text: 'Ma petite démarche') expect(page).to have_selector('.fr-breadcrumb li', text: 'Ma petite démarche')

View file

@ -1,15 +1,5 @@
RSpec.describe 'administrateurs/procedures/edit', type: :view do RSpec.describe 'administrateurs/procedures/edit', type: :view do
let(:logo) { fixture_file_upload('spec/fixtures/files/logo_test_procedure.png', 'image/png') } let(:procedure) { create(:procedure, lien_site_web: 'http://some.website') }
let(:procedure) { create(:procedure, logo: logo, lien_site_web: 'http://some.website') }
context 'when procedure logo is present' do
it 'display on the page' do
assign(:procedure, procedure)
render
expect(rendered).to have_selector('.procedure-logos')
end
end
context 'when opendata is enabled' do context 'when opendata is enabled' do
it 'asks for opendata' do it 'asks for opendata' do