2016-06-07 15:16:35 +02:00
|
|
|
describe 'layouts/_navbar.html.haml', type: :view do
|
|
|
|
let(:administrateur) { create(:administrateur) }
|
2019-08-06 11:02:54 +02:00
|
|
|
let(:instructeur) { create(:instructeur, administrateurs: [administrateur]) }
|
2016-06-07 15:16:35 +02:00
|
|
|
|
|
|
|
let!(:procedure) { create(:procedure, administrateur: administrateur) }
|
|
|
|
|
2019-08-08 17:36:08 +02:00
|
|
|
before do
|
|
|
|
allow(view).to receive(:instructeur_signed_in?).and_return(instructeur_signed_in)
|
|
|
|
allow(view).to receive(:administrateur_signed_in?).and_return(administrateur_signed_in)
|
|
|
|
end
|
|
|
|
|
2016-06-07 15:16:35 +02:00
|
|
|
describe 'navbar entries' do
|
2019-08-08 17:36:08 +02:00
|
|
|
before { render }
|
|
|
|
|
|
|
|
subject { rendered }
|
|
|
|
|
2016-06-07 15:16:35 +02:00
|
|
|
context 'when disconnected' do
|
2019-08-08 17:36:08 +02:00
|
|
|
let(:instructeur_signed_in) { false }
|
|
|
|
let(:administrateur_signed_in) { false }
|
|
|
|
|
2016-12-13 16:10:03 +01:00
|
|
|
it { is_expected.to match(/Connexion/) }
|
2016-06-07 15:16:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when administrateur is connected' do
|
2019-08-08 17:36:08 +02:00
|
|
|
let(:instructeur_signed_in) { false }
|
|
|
|
let(:administrateur_signed_in) { true }
|
|
|
|
|
2016-12-13 16:10:03 +01:00
|
|
|
it { is_expected.to match(/Déconnexion/) }
|
2016-06-07 15:16:35 +02:00
|
|
|
end
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
context 'when instructeur is connected' do
|
2019-08-08 17:36:08 +02:00
|
|
|
let(:instructeur_signed_in) { true }
|
|
|
|
let(:administrateur_signed_in) { false }
|
|
|
|
|
2016-08-22 16:36:25 +02:00
|
|
|
it { is_expected.to match(/Déconnexion/) }
|
2016-06-07 15:16:35 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|