2016-06-07 15:16:35 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
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) }
|
|
|
|
|
|
|
|
describe 'navbar entries' do
|
|
|
|
context 'when disconnected' do
|
|
|
|
before do
|
|
|
|
render
|
|
|
|
end
|
|
|
|
subject { rendered }
|
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
|
|
|
|
before do
|
|
|
|
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
|
|
|
|
@current_user = administrateur
|
|
|
|
sign_in @current_user
|
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { rendered }
|
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
|
2016-06-07 15:16:35 +02:00
|
|
|
before do
|
2019-08-06 11:02:54 +02:00
|
|
|
@request.env["devise.mapping"] = Devise.mappings[:instructeur]
|
|
|
|
@current_user = instructeur
|
2016-06-07 15:16:35 +02:00
|
|
|
sign_in @current_user
|
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { rendered }
|
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
|