[fix #2777] DossiersSerializer: add state
This commit is contained in:
parent
87e731bc75
commit
2288303de9
3 changed files with 9 additions and 2 deletions
|
@ -1,9 +1,14 @@
|
|||
class DossiersSerializer < ActiveModel::Serializer
|
||||
attributes :id,
|
||||
:updated_at,
|
||||
:initiated_at
|
||||
:initiated_at,
|
||||
:state
|
||||
|
||||
def initiated_at
|
||||
object.en_construction_at
|
||||
end
|
||||
|
||||
def state
|
||||
object.old_state_value
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,7 +77,8 @@ describe API::V1::DossiersController do
|
|||
it { expect(subject[:id]).to eq(dossier.id) }
|
||||
it { expect(subject[:updated_at]).to eq("2008-09-01T10:05:00.000Z") }
|
||||
it { expect(subject[:initiated_at]).to eq("2008-09-01T10:06:00.000Z") }
|
||||
it { expect(subject.keys.size).to eq(3) }
|
||||
it { expect(subject[:state]).to eq("initiated") }
|
||||
it { expect(subject.keys.size).to eq(4) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ describe DossiersSerializer do
|
|||
let(:dossier) { create(:dossier, :en_construction) }
|
||||
|
||||
it { is_expected.to include(initiated_at: dossier.en_construction_at) }
|
||||
it { is_expected.to include(state: 'initiated') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue