[#2741] Expand unit tests for sorted_ids just to be sure
This commit is contained in:
parent
37fb358bd5
commit
c652cf3ae5
1 changed files with 25 additions and 7 deletions
|
@ -257,9 +257,26 @@ describe ProcedurePresentation do
|
|||
|
||||
context 'for self table' do
|
||||
let(:table) { 'self' }
|
||||
let(:column) { 'updated_at' } # All other columns work the same, no extra test required
|
||||
let(:order) { 'asc' } # Desc works the same, no extra test required
|
||||
|
||||
context 'for created_at column' do
|
||||
let(:column) { 'created_at' }
|
||||
let!(:recent_dossier) { Timecop.freeze(DateTime.new(2018, 10, 17)) { create(:dossier, procedure: procedure) } }
|
||||
let!(:older_dossier) { Timecop.freeze(DateTime.new(2003, 11, 11)) { create(:dossier, procedure: procedure) } }
|
||||
|
||||
it { is_expected.to eq([older_dossier, recent_dossier].map(&:id)) }
|
||||
end
|
||||
|
||||
context 'for en_construction_at column' do
|
||||
let(:column) { 'en_construction_at' }
|
||||
let!(:recent_dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: DateTime.new(2018, 10, 17)) }
|
||||
let!(:older_dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: DateTime.new(2013, 1, 1)) }
|
||||
|
||||
it { is_expected.to eq([older_dossier, recent_dossier].map(&:id)) }
|
||||
end
|
||||
|
||||
context 'for updated_at column' do
|
||||
let(:column) { 'updated_at' }
|
||||
let(:recent_dossier) { create(:dossier, procedure: procedure) }
|
||||
let(:older_dossier) { create(:dossier, procedure: procedure) }
|
||||
|
||||
|
@ -270,6 +287,7 @@ describe ProcedurePresentation do
|
|||
|
||||
it { is_expected.to eq([older_dossier, recent_dossier].map(&:id)) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'for type_de_champ table' do
|
||||
let(:table) { 'type_de_champ' }
|
||||
|
|
Loading…
Reference in a new issue