fix specs
This commit is contained in:
parent
4a51a9a351
commit
b6cc35df68
8 changed files with 45 additions and 12 deletions
|
@ -12,10 +12,21 @@ function syncFormToPreview() {
|
||||||
syncInputToElement('#procedure_libelle', '.procedure-title');
|
syncInputToElement('#procedure_libelle', '.procedure-title');
|
||||||
syncInputToElement('#procedure_description', '.procedure-description-body');
|
syncInputToElement('#procedure_description', '.procedure-description-body');
|
||||||
syncInputToElement('#procedure_description_what', '.js_description_what p');
|
syncInputToElement('#procedure_description_what', '.js_description_what p');
|
||||||
syncInputToElement('#procedure_description_for_who', '.js_description_for_who p');
|
syncInputToElement(
|
||||||
|
'#procedure_description_for_who',
|
||||||
|
'.js_description_for_who p'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate('input', '.procedure-form #procedure_libelle', syncFormToPreview);
|
delegate('input', '.procedure-form #procedure_libelle', syncFormToPreview);
|
||||||
delegate('input', '.procedure-form #procedure_description', syncFormToPreview);
|
delegate('input', '.procedure-form #procedure_description', syncFormToPreview);
|
||||||
delegate('input', '.procedure-form #procedure_description_what', syncFormToPreview);
|
delegate(
|
||||||
delegate('input', '.procedure-form #procedure_description_for_who', syncFormToPreview);
|
'input',
|
||||||
|
'.procedure-form #procedure_description_what',
|
||||||
|
syncFormToPreview
|
||||||
|
);
|
||||||
|
delegate(
|
||||||
|
'input',
|
||||||
|
'.procedure-form #procedure_description_for_who',
|
||||||
|
syncFormToPreview
|
||||||
|
);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
= render partial: 'shared/procedure_description', locals: { procedure: procedure }
|
= render partial: 'shared/procedure_description', locals: { procedure: procedure }
|
||||||
- else
|
- else
|
||||||
= render partial: 'layouts/commencer/no_procedure'
|
= render partial: 'layouts/commencer/no_procedure'
|
||||||
|
= yield
|
||||||
|
|
||||||
- content_for :footer do
|
- content_for :footer do
|
||||||
- if procedure
|
- if procedure
|
||||||
|
|
|
@ -178,9 +178,26 @@ describe Procedure do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'description' do
|
context 'description' do
|
||||||
it { is_expected.not_to allow_value(nil).for(:description) }
|
context 'description can not be nil if description_what and description_for_who are nil too' do
|
||||||
it { is_expected.not_to allow_value('').for(:description) }
|
let(:procedure) { build(:procedure, description: nil) }
|
||||||
it { is_expected.to allow_value('Description Demande de subvention').for(:description) }
|
it { is_expected.to allow_value('Description Demande de subvention').for(:description) }
|
||||||
|
it { expect(procedure.valid?).to eq(false) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'description can be nil if description_what and description_for_who are filled' do
|
||||||
|
let(:procedure) { build(:procedure, description: nil, description_for_who: 'for who', description_what: 'what') }
|
||||||
|
it { expect(procedure.valid?).to eq(true) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'description_what and description_for_who can not be nil if description is nil too' do
|
||||||
|
let(:procedure) { build(:procedure, description: nil) }
|
||||||
|
it { expect(procedure.valid?).to eq(false) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'description_what and description_for_who can be nil if description is filled' do
|
||||||
|
let(:procedure) { build(:procedure, description: 'description') }
|
||||||
|
it { expect(procedure.valid?).to eq(true) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'organisation' do
|
context 'organisation' do
|
||||||
|
|
|
@ -5,5 +5,9 @@ module Capybara
|
||||||
def has_procedure_description?(procedure)
|
def has_procedure_description?(procedure)
|
||||||
has_content?(procedure.libelle) && has_content?(procedure.description) && has_content?(procedure.service.email)
|
has_content?(procedure.libelle) && has_content?(procedure.description) && has_content?(procedure.service.email)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_procedure_sumup_description?(procedure)
|
||||||
|
has_content?(procedure.libelle) && has_content?(procedure.service.email)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,7 +43,7 @@ describe 'Signin in:' do
|
||||||
click_on 'Commencer la démarche'
|
click_on 'Commencer la démarche'
|
||||||
|
|
||||||
expect(page).to have_current_path identite_dossier_path(user.reload.dossiers.last)
|
expect(page).to have_current_path identite_dossier_path(user.reload.dossiers.last)
|
||||||
expect(page).to have_procedure_description(procedure)
|
expect(page).to have_procedure_sumup_description(procedure)
|
||||||
expect(page).to have_content "Données d’identité"
|
expect(page).to have_content "Données d’identité"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -84,7 +84,7 @@ describe 'Signing up:' do
|
||||||
click_on 'Commencer la démarche'
|
click_on 'Commencer la démarche'
|
||||||
|
|
||||||
expect(page).to have_current_path identite_dossier_path(procedure.reload.dossiers.last)
|
expect(page).to have_current_path identite_dossier_path(procedure.reload.dossiers.last)
|
||||||
expect(page).to have_procedure_description(procedure)
|
expect(page).to have_procedure_sumup_description(procedure)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue