demarches-normaliennes/spec/views/users/dossiers/etablissement.html.haml_spec.rb
Christophe Robillard f40123fee1 display only etablissement infos
all the other infos are not yet available because the jobs which
retrieve it are performed later
2020-05-20 11:09:54 +02:00

30 lines
1.1 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

describe 'users/dossiers/etablissement.html.haml', type: :view do
let(:etablissement) { create(:etablissement, :with_exercices) }
let(:dossier) { create(:dossier, etablissement: etablissement) }
let(:footer) { view.content_for(:footer) }
before do
sign_in dossier.user
assign(:dossier, dossier)
allow_any_instance_of(ApiEntrepriseToken).to receive(:roles).and_return([])
allow_any_instance_of(ApiEntrepriseToken).to receive(:expired?).and_return(false)
end
subject! { render }
it 'affiche les informations de létablissement' do
expect(rendered).to have_text(etablissement.siret)
end
context 'etablissement avec infos non diffusables' do
let(:etablissement) { create(:etablissement, :with_exercices, :non_diffusable) }
it "affiche uniquement le nom de l'établissement si infos non diffusables" do
expect(rendered).to have_text(etablissement.entreprise_raison_sociale)
expect(rendered).not_to have_text(etablissement.entreprise.forme_juridique)
end
end
it 'prépare le footer' do
expect(footer).to have_selector('footer')
end
end