2015-08-10 11:05:06 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe StartController, type: :controller do
|
2015-09-22 15:36:44 +02:00
|
|
|
let!(:procedure) { create(:procedure) }
|
|
|
|
|
2015-08-20 16:52:36 +02:00
|
|
|
describe 'GET #index' do
|
2015-09-22 10:52:55 +02:00
|
|
|
before do
|
|
|
|
get :index, procedure_id: procedure
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when params procedure_id is present' do
|
|
|
|
context 'when procedure_id is valid' do
|
|
|
|
it { expect(response).to have_http_status(:success) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when procedure_id is not valid' do
|
|
|
|
let(:procedure) { '' }
|
|
|
|
it { expect(response).to have_http_status(404) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when params procedure_id is not present' do
|
|
|
|
before do
|
|
|
|
get :index
|
|
|
|
end
|
|
|
|
it { expect(response).to have_http_status(404) }
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-20 16:52:36 +02:00
|
|
|
describe 'GET #index with bad SIRET' do
|
2015-08-10 11:05:06 +02:00
|
|
|
before do
|
2015-09-22 15:36:44 +02:00
|
|
|
get :error_siret, procedure_id: procedure
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
2015-08-20 16:52:36 +02:00
|
|
|
it 'returns http success and flash alert is present' do
|
2015-08-10 11:05:06 +02:00
|
|
|
expect(response).to have_http_status(:success)
|
|
|
|
end
|
|
|
|
it 'la flash alert est présente' do
|
|
|
|
expect(flash[:alert]).to be_present
|
|
|
|
end
|
|
|
|
it 'la flash alert a un libellé correct' do
|
|
|
|
expect(flash[:alert]).to have_content('Ce SIRET n\'est pas valide')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-20 16:52:36 +02:00
|
|
|
describe 'GET #index with bad LOGIN' do
|
2015-08-10 11:05:06 +02:00
|
|
|
before do
|
|
|
|
get :error_login
|
|
|
|
end
|
|
|
|
|
2015-08-20 16:52:36 +02:00
|
|
|
it 'returns http success and flash alert is present' do
|
2015-08-10 11:05:06 +02:00
|
|
|
expect(response).to have_http_status(:success)
|
|
|
|
end
|
|
|
|
it 'la flash alert est présente' do
|
|
|
|
expect(flash[:alert]).to be_present
|
|
|
|
end
|
|
|
|
it 'la flash alert a un libellé correct' do
|
|
|
|
expect(flash[:alert]).to have_content('Ce compte n\'existe pas')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-20 16:52:36 +02:00
|
|
|
describe 'GET #index with bad DOSSIER' do
|
2015-08-10 11:05:06 +02:00
|
|
|
before do
|
|
|
|
get :error_dossier
|
|
|
|
end
|
|
|
|
|
2015-08-20 16:52:36 +02:00
|
|
|
it 'returns http success and flash alert is present' do
|
2015-08-10 11:05:06 +02:00
|
|
|
expect(response).to have_http_status(:success)
|
|
|
|
end
|
|
|
|
it 'la flash alert est présente' do
|
|
|
|
expect(flash[:alert]).to be_present
|
|
|
|
end
|
|
|
|
it 'la flash alert a un libellé correct' do
|
|
|
|
expect(flash[:alert]).to have_content('Ce dossier n\'existe pas')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|