Refactor link attribute generation on ProcedureSerializer

This commit is contained in:
Paul Chavard 2018-10-22 19:22:51 +02:00
parent 7cf225d443
commit 4ebc0b7f4c
4 changed files with 25 additions and 4 deletions

View file

@ -36,7 +36,6 @@ describe API::V1::ProceduresController, type: :controller do
it { expect(subject[:description]).to eq(procedure.description) }
it { expect(subject[:organisation]).to eq(procedure.organisation) }
it { expect(subject[:direction]).to eq(procedure.direction) }
it { expect(subject[:link]).to eq(procedure.lien_demarche) }
it { expect(subject[:archived_at]).to eq(procedure.archived_at) }
it { expect(subject[:total_dossier]).to eq(procedure.total_dossier) }
it { is_expected.to have_key(:types_de_champ) }

View file

@ -0,0 +1,10 @@
describe ProcedureSerializer do
describe '#attributes' do
subject { ProcedureSerializer.new(procedure).serializable_hash }
let(:procedure) { create(:procedure, :published) }
it {
is_expected.to include(link: "http://localhost:3000/commencer/#{procedure.path}")
}
end
end