2016-05-24 16:39:39 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe AccompagnateurService do
|
2017-07-18 15:26:33 +02:00
|
|
|
let(:procedure) { create :procedure, :published }
|
2016-09-08 16:21:54 +02:00
|
|
|
let(:accompagnateur) { create :gestionnaire }
|
|
|
|
|
2016-10-07 12:10:58 +02:00
|
|
|
let(:accompagnateur_service) { AccompagnateurService.new accompagnateur, procedure, to}
|
|
|
|
|
2016-09-08 16:21:54 +02:00
|
|
|
describe '#change_assignement!' do
|
2017-06-12 16:12:03 +02:00
|
|
|
subject { accompagnateur_service.change_assignement! }
|
2016-05-24 16:39:39 +02:00
|
|
|
|
|
|
|
context 'when accompagnateur is not assign at the procedure' do
|
|
|
|
let(:to) { AccompagnateurService::ASSIGN }
|
|
|
|
|
|
|
|
before do
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(accompagnateur.procedures).to include procedure }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when accompagnateur is assign at the procedure' do
|
|
|
|
let(:to) { AccompagnateurService::NOT_ASSIGN }
|
|
|
|
|
|
|
|
before do
|
|
|
|
create :assign_to, gestionnaire: accompagnateur, procedure: procedure
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(accompagnateur.procedures).not_to include procedure }
|
|
|
|
end
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|