-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spec(normalized_address): add simple spec
- Loading branch information
Showing
4 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
spec/views/shared/dossiers/_normalized_address.html.haml_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
describe 'shared/dossiers/normalized_address', type: :view do | ||
before { render 'shared/dossiers/normalized_address', address: } | ||
|
||
context 'given an champ' do | ||
let(:procedure) { create(:procedure, types_de_champ_public: [{ type: :siret }]) } | ||
let(:dossier) { create(:dossier, :with_populated_champs, procedure:) } | ||
let(:address) { AddressProxy.new(dossier.champs.first) } | ||
|
||
it 'render address' do | ||
AddressProxy::ADDRESS_PARTS.each do |address_part| | ||
expect(rendered).to have_text(address_part) | ||
end | ||
end | ||
end | ||
|
||
context 'given an etablissement' do | ||
let(:etablissement) { create(:etablissement) } | ||
let(:address) { AddressProxy.new(etablissement) } | ||
|
||
it 'render address' do | ||
expect(rendered).to have_text("6 RUE RAOUL NORDLING") | ||
expect(rendered).to have_text("BOIS COLOMBES 92270") | ||
expect(rendered).to have_text("92009") | ||
expect(rendered).to have_text("92270") | ||
expect(rendered).to have_text("Hauts-de-Seine – 92") | ||
expect(rendered).to have_text("Île-de-France – 11") | ||
end | ||
end | ||
end |