Merge pull request #1579 from betagouv/fix-1577

[Fix #1577] logo link in navbar on gestionnaire UI should not link to…
This commit is contained in:
Mathieu Magnin 2018-03-08 14:15:55 +01:00 committed by GitHub
commit 7f76cc4684
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 1 deletions

View file

@ -19,4 +19,15 @@ module ApplicationHelper
current_gestionnaire.try(:email) ||
current_administrateur.try(:email)
end
def root_path_for_profile(nav_bar_profile)
case nav_bar_profile
when :gestionnaire
gestionnaire_procedures_path
when :user
users_dossiers_path
else
root_path
end
end
end

View file

@ -4,7 +4,7 @@
.header-inner-content
.flex.align-center
= link_to root_path, class: "header-logo" do
= link_to root_path_for_profile(nav_bar_profile), class: "header-logo" do
%img{ src: image_url("header/logo-ds.svg"), alt: "Logo de demarches-simplifiees.fr" }
- if nav_bar_profile == :gestionnaire && gestionnaire_signed_in?

View file

@ -0,0 +1,24 @@
require 'spec_helper'
describe 'layouts/_new_header.html.haml', type: :view do
describe 'logo link' do
before do
allow(controller).to receive(:nav_bar_profile).and_return(profile)
render
end
subject { rendered }
context 'when rendering for user' do
let(:profile) { :user }
it { is_expected.to have_css("a.header-logo[href=\"#{users_dossiers_path}\"]") }
end
context 'when rendering for gestionnaire' do
let(:profile) { :gestionnaire }
it { is_expected.to have_css("a.header-logo[href=\"#{gestionnaire_procedures_path}\"]") }
end
end
end