demarches-normaliennes/spec/serializers/dossier_table_export_serializer_spec.rb

31 lines
850 B
Ruby
Raw Normal View History

2017-04-14 18:10:39 +02:00
require 'spec_helper'
describe DossierTableExportSerializer do
describe '#emails_accompagnateurs' do
let(:gestionnaire){ create(:gestionnaire) }
2017-07-18 15:03:08 +02:00
let(:gestionnaire2) { create :gestionnaire}
let(:dossier) { create(:dossier) }
2017-04-14 18:10:39 +02:00
subject { DossierTableExportSerializer.new(dossier).emails_accompagnateurs }
context 'when there is no accompagnateurs' do
it { is_expected.to eq('') }
end
context 'when there one accompagnateur' do
2017-07-18 15:03:08 +02:00
before { gestionnaire.followed_dossiers << dossier }
2017-04-14 18:10:39 +02:00
it { is_expected.to eq(gestionnaire.email) }
end
context 'when there is 2 followers' do
2017-07-18 15:03:08 +02:00
before do
gestionnaire.followed_dossiers << dossier
gestionnaire2.followed_dossiers << dossier
end
2017-04-14 18:10:39 +02:00
it { is_expected.to eq "#{gestionnaire.email} #{gestionnaire2.email}" }
end
end
end