2016-05-24 16:39:39 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-11-15 05:19:30 +01:00
|
|
|
describe Admin::AccompagnateursController, type: :controller do
|
2016-05-24 16:39:39 +02:00
|
|
|
let(:admin) { create(:administrateur) }
|
|
|
|
let(:procedure) { create :procedure, administrateur: admin }
|
|
|
|
let(:gestionnaire) { create :gestionnaire, administrateurs: [admin] }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in admin
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET #show' do
|
2016-11-15 05:19:30 +01:00
|
|
|
subject { get :show, params: {procedure_id: procedure.id} }
|
|
|
|
it { expect(subject.status).to eq(200) }
|
2016-05-24 16:39:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'PUT #update' do
|
2016-11-15 05:19:30 +01:00
|
|
|
subject { put :update, params: {accompagnateur_id: gestionnaire.id, procedure_id: procedure.id, to: 'assign'} }
|
2016-05-24 16:39:39 +02:00
|
|
|
|
|
|
|
it { expect(subject).to redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure.id) }
|
|
|
|
|
|
|
|
context 'when assignement is valid' do
|
|
|
|
before do
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(flash[:notice]).to be_present }
|
|
|
|
end
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|