Add commentaires on API Show Dossier
This commit is contained in:
parent
04c5432be1
commit
b49770f408
3 changed files with 19 additions and 0 deletions
5
app/serializers/commentaire_serializer.rb
Normal file
5
app/serializers/commentaire_serializer.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class CommentaireSerializer < ActiveModel::Serializer
|
||||
attributes :email,
|
||||
:body,
|
||||
:created_at
|
||||
end
|
|
@ -10,6 +10,7 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
has_one :entreprise
|
||||
has_one :etablissement
|
||||
has_one :cerfa
|
||||
has_many :commentaires
|
||||
has_many :champs
|
||||
has_many :pieces_justificatives
|
||||
end
|
|
@ -219,6 +219,19 @@ describe API::V1::DossiersController do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'commentaires' do
|
||||
let!(:commentaire) { create :commentaire, body: 'plop', created_at: '2016-03-14 14:00:00', email: 'plop@plip.com', dossier: dossier }
|
||||
let!(:commentaire_2) { create :commentaire, body: 'plip', created_at: '2016-03-14 15:00:00', email: 'plip@plap.com', dossier: dossier }
|
||||
|
||||
subject { super()[:commentaires] }
|
||||
|
||||
it { expect(subject.size).to eq 2 }
|
||||
|
||||
it { expect(subject.first[:body]).to eq 'plop' }
|
||||
it { expect(subject.first[:created_at]).to eq '2016-03-14T14:00:00.000Z' }
|
||||
it { expect(subject.first[:email]).to eq 'plop@plip.com' }
|
||||
end
|
||||
|
||||
describe 'etablissement' do
|
||||
let(:field_list) { [
|
||||
:siret,
|
||||
|
|
Loading…
Add table
Reference in a new issue