2015-10-26 16:10:38 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe RootController, type: :controller do
|
|
|
|
|
|
|
|
subject { get :index }
|
|
|
|
|
|
|
|
context 'when User is connected' do
|
|
|
|
before do
|
|
|
|
sign_in create(:user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(subject).to redirect_to(users_dossiers_path) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when Gestionnaire is connected' do
|
|
|
|
before do
|
|
|
|
sign_in create(:gestionnaire)
|
|
|
|
end
|
|
|
|
|
2015-12-02 18:03:52 +01:00
|
|
|
it { expect(subject).to redirect_to(backoffice_dossiers_path) }
|
2015-10-26 16:10:38 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when Administrateur is connected' do
|
|
|
|
before do
|
|
|
|
sign_in create(:administrateur)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(subject).to redirect_to(admin_procedures_path) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when nobody is connected' do
|
2016-02-01 17:16:00 +01:00
|
|
|
render_views
|
|
|
|
|
|
|
|
before do
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(response.body).to have_css('#landing') }
|
2015-10-26 16:10:38 +01:00
|
|
|
end
|
|
|
|
end
|