Add implicit_order_column on revisions

This commit is contained in:
Paul Chavard 2020-07-22 11:56:19 +02:00
parent 733b8bd904
commit a08e318617
2 changed files with 3 additions and 2 deletions

View file

@ -1,4 +1,5 @@
class ProcedureRevision < ApplicationRecord
self.implicit_order_column = :created_at
belongs_to :procedure, -> { with_discarded }, inverse_of: :revisions
has_many :revision_types_de_champ, -> { public_only.ordered }, class_name: 'ProcedureRevisionTypeDeChamp', foreign_key: :revision_id, dependent: :destroy, inverse_of: :revision

View file

@ -687,7 +687,7 @@ describe Procedure do
expect(procedure.published_revision).not_to be_nil
expect(procedure.draft_revision).not_to be_nil
expect(procedure.revisions.count).to eq(2)
expect(procedure.revisions.last).to eq(procedure.draft_revision)
expect(procedure.revisions).to eq([procedure.published_revision, procedure.draft_revision])
end
end
@ -768,7 +768,7 @@ describe Procedure do
expect(procedure.published_revision).not_to be_nil
expect(procedure.draft_revision).not_to be_nil
expect(procedure.revisions.count).to eq(2)
expect(procedure.revisions.last).to eq(procedure.draft_revision)
expect(procedure.revisions).to eq([procedure.published_revision, procedure.draft_revision])
end
end