Add Cerfa on API Show dossier
This commit is contained in:
parent
b49770f408
commit
e944364929
2 changed files with 16 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
class CerfaSerializer < ActiveModel::Serializer
|
class CerfaSerializer < ActiveModel::Serializer
|
||||||
|
|
||||||
attributes :content_url => :url
|
attributes :content_url => :url
|
||||||
|
|
||||||
end
|
end
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe API::V1::DossiersController do
|
describe API::V1::DossiersController do
|
||||||
let(:admin) { create(:administrateur) }
|
let(:admin) { create(:administrateur) }
|
||||||
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, administrateur: admin) }
|
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, administrateur: admin, cerfa_flag: true) }
|
||||||
let(:wrong_procedure) { create(:procedure) }
|
let(:wrong_procedure) { create(:procedure) }
|
||||||
|
|
||||||
it { expect(described_class).to be < APIController }
|
it { expect(described_class).to be < APIController }
|
||||||
|
@ -116,7 +116,7 @@ describe API::V1::DossiersController do
|
||||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } }
|
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } }
|
||||||
let(:dossier_id) { dossier.id }
|
let(:dossier_id) { dossier.id }
|
||||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||||
let(:field_list) { [:id, :nom_projet, :created_at, :updated_at, :description, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :pieces_justificatives, :champs] }
|
let(:field_list) { [:id, :nom_projet, :created_at, :updated_at, :description, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :pieces_justificatives, :champs, :commentaires] }
|
||||||
subject { body[:dossier] }
|
subject { body[:dossier] }
|
||||||
|
|
||||||
it 'return REST code 200', :show_in_doc do
|
it 'return REST code 200', :show_in_doc do
|
||||||
|
@ -232,6 +232,19 @@ describe API::V1::DossiersController do
|
||||||
it { expect(subject.first[:email]).to eq 'plop@plip.com' }
|
it { expect(subject.first[:email]).to eq 'plop@plip.com' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'cerfa' do
|
||||||
|
let(:content) { File.open('./spec/support/files/piece_justificative_388.pdf') }
|
||||||
|
|
||||||
|
before do
|
||||||
|
dossier.cerfa.content = content
|
||||||
|
dossier.cerfa.save
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { super()[:cerfa] }
|
||||||
|
|
||||||
|
it { expect(subject[:url]).to match /^http:\/\/.*downloads.*_CERFA\.pdf$/ }
|
||||||
|
end
|
||||||
|
|
||||||
describe 'etablissement' do
|
describe 'etablissement' do
|
||||||
let(:field_list) { [
|
let(:field_list) { [
|
||||||
:siret,
|
:siret,
|
||||||
|
|
Loading…
Reference in a new issue