From 51e256e1229b82225d20f08b12d18507c4f89b43 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 25 Jun 2018 11:26:37 +0200 Subject: [PATCH] header: fix link to the contact email --- app/views/layouts/_new_header.haml | 3 ++- spec/views/layouts/_new_header_spec.rb | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index f865b5f9f..abf0f3ba0 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -29,7 +29,8 @@ %br – par téléphone : 01 76 42 02 87 %br - = "– par email : #{CONTACT_EMAIL}" + – par email : + = link_to CONTACT_EMAIL, "mailto:#{CONTACT_EMAIL}" - if nav_bar_profile == :user %ul.header-tabs diff --git a/spec/views/layouts/_new_header_spec.rb b/spec/views/layouts/_new_header_spec.rb index 39a9ae58e..8ccbec46f 100644 --- a/spec/views/layouts/_new_header_spec.rb +++ b/spec/views/layouts/_new_header_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' describe 'layouts/_new_header.html.haml', type: :view do describe 'logo link' do before do + sign_in user allow(controller).to receive(:nav_bar_profile).and_return(profile) render end @@ -10,15 +11,22 @@ describe 'layouts/_new_header.html.haml', type: :view do subject { rendered } context 'when rendering for user' do + let(:user) { create(:user) } let(:profile) { :user } it { is_expected.to have_css("a.header-logo[href=\"#{users_dossiers_path}\"]") } end context 'when rendering for gestionnaire' do + let(:user) { create(:gestionnaire) } let(:profile) { :gestionnaire } it { is_expected.to have_css("a.header-logo[href=\"#{gestionnaire_procedures_path}\"]") } + + it "displays the contact infos" do + expect(rendered).to have_text("Contact") + expect(rendered).to have_link(CONTACT_EMAIL, href: "mailto:#{CONTACT_EMAIL}") + end end end end