demarches-normaliennes/spec/services/accompagnateur_service_spec.rb

34 lines
913 B
Ruby
Raw Normal View History

require 'spec_helper'
describe AccompagnateurService do
let(:procedure) { create :procedure, :published }
let(:accompagnateur) { create :gestionnaire }
let(:accompagnateur_service) { AccompagnateurService.new accompagnateur, procedure, to}
describe '#change_assignement!' do
2017-06-12 16:12:03 +02:00
subject { accompagnateur_service.change_assignement! }
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