2018-03-08 13:54:26 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'layouts/_new_header.html.haml', type: :view do
|
|
|
|
describe 'logo link' do
|
|
|
|
before do
|
2018-08-29 15:01:09 +02:00
|
|
|
Flipflop::FeatureSet.current.test!.switch!(:support_form, true)
|
2018-06-25 11:26:37 +02:00
|
|
|
sign_in user
|
2018-03-08 13:54:26 +01:00
|
|
|
allow(controller).to receive(:nav_bar_profile).and_return(profile)
|
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { rendered }
|
|
|
|
|
|
|
|
context 'when rendering for user' do
|
2018-06-25 11:26:37 +02:00
|
|
|
let(:user) { create(:user) }
|
2018-03-08 13:54:26 +01:00
|
|
|
let(:profile) { :user }
|
|
|
|
|
2018-06-27 14:47:02 +02:00
|
|
|
it { is_expected.to have_css("a.header-logo[href=\"#{dossiers_path}\"]") }
|
|
|
|
it { is_expected.to have_link("Dossiers", href: dossiers_path) }
|
2018-03-08 13:54:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when rendering for gestionnaire' do
|
2018-06-25 11:26:37 +02:00
|
|
|
let(:user) { create(:gestionnaire) }
|
2018-03-08 13:54:26 +01:00
|
|
|
let(:profile) { :gestionnaire }
|
|
|
|
|
|
|
|
it { is_expected.to have_css("a.header-logo[href=\"#{gestionnaire_procedures_path}\"]") }
|
2018-06-25 11:26:37 +02:00
|
|
|
|
|
|
|
it "displays the contact infos" do
|
|
|
|
expect(rendered).to have_text("Contact")
|
2018-10-18 18:24:45 +02:00
|
|
|
expect(rendered).to have_link("par email", href: contact_url)
|
2018-06-25 11:26:37 +02:00
|
|
|
end
|
2018-03-08 13:54:26 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|