Skip to content

Commit

Permalink
refactor(combobox): fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
tchak committed May 9, 2024
1 parent 4cb580b commit 89dbce0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
16 changes: 7 additions & 9 deletions spec/models/champs/annuaire_education_champ_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,19 @@
it_behaves_like "a data updater (without updating the value)", ''
end

context 'when data is inconsistent' do
let(:data) { { 'yo' => 'lo' } }
it_behaves_like "a data updater (without updating the value)", { 'yo' => 'lo' }
end

context 'when data is consistent' do
let(:data) {
{
'nom_etablissement': "karrigel an ankou",
'nom_etablissement' => "karrigel an ankou",
'nom_commune' => 'kumun',
'identifiant_de_l_etablissement' => '666667'
}.with_indifferent_access
}
}
it_behaves_like "a data updater (without updating the value)", {
'nom_etablissement' => "karrigel an ankou",
'nom_commune' => 'kumun',
'identifiant_de_l_etablissement' => '666667'
}
it { expect { subject }.to change { champ.reload.data }.to(data) }
it { expect { subject }.to change { champ.reload.value }.to('karrigel an ankou, kumun (666667)') }
end
end
end
4 changes: 2 additions & 2 deletions spec/system/users/brouillon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
select('02 – Aisne', from: form_id_for('departements'))

fill_in('communes', with: '60400')
find('li', text: 'Brétigny (60400)').click
find('.fr-menu__item', text: 'Brétigny (60400)').click
wait_until { champ_value_for('communes') == "Brétigny" }

fill_in('address', with: '78 Rue du Grés 30310 Vergè')
find('li', text: '78 Rue du Grés 30310 Vergèze').click
find('.fr-menu__item', text: '78 Rue du Grés 30310 Vergèze').click
wait_until { champ_value_for('address') == '78 Rue du Grés 30310 Vergèze' }
wait_until { champ_for('address').full_address? }
expect(champ_for('address').departement_code_and_name).to eq('30 – Gard')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
let(:instructeur) { create(:instructeur, email: 'yop@totomail.fr') }
let(:potential_recipients) { [instructeur] }

it { is_expected.to match(/data-react-props.*#{instructeur.email}/) }
it { is_expected.to match(/props.*#{instructeur.email}/) }
it { is_expected.to have_css(".fr-btn") }
end

Expand Down

0 comments on commit 89dbce0

Please sign in to comment.