fix specs
This commit is contained in:
parent
4a51a9a351
commit
b6cc35df68
8 changed files with 45 additions and 12 deletions
|
@ -178,9 +178,26 @@ describe Procedure do
|
|||
end
|
||||
|
||||
context 'description' do
|
||||
it { is_expected.not_to allow_value(nil).for(:description) }
|
||||
it { is_expected.not_to allow_value('').for(:description) }
|
||||
it { is_expected.to allow_value('Description Demande de subvention').for(:description) }
|
||||
context 'description can not be nil if description_what and description_for_who are nil too' do
|
||||
let(:procedure) { build(:procedure, description: nil) }
|
||||
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
|
||||
|
||||
context 'organisation' do
|
||||
|
|
|
@ -5,5 +5,9 @@ module Capybara
|
|||
def has_procedure_description?(procedure)
|
||||
has_content?(procedure.libelle) && has_content?(procedure.description) && has_content?(procedure.service.email)
|
||||
end
|
||||
|
||||
def has_procedure_sumup_description?(procedure)
|
||||
has_content?(procedure.libelle) && has_content?(procedure.service.email)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -43,7 +43,7 @@ describe 'Signin in:' do
|
|||
click_on 'Commencer la démarche'
|
||||
|
||||
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é"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -84,7 +84,7 @@ describe 'Signing up:' do
|
|||
click_on 'Commencer la démarche'
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue