fix(revision): changed? conflicts with rails method

This commit is contained in:
Paul Chavard 2022-01-12 17:38:57 +01:00
parent e6a942a5fc
commit c1cb89bb44
3 changed files with 3 additions and 3 deletions

View file

@ -373,7 +373,7 @@ class Procedure < ApplicationRecord
end
def draft_changed?
publiee? && published_revision.changed?(draft_revision) && revision_changes.present?
publiee? && published_revision.different_from?(draft_revision) && revision_changes.present?
end
def revision_changes

View file

@ -105,7 +105,7 @@ class ProcedureRevision < ApplicationRecord
!draft?
end
def changed?(revision)
def different_from?(revision)
types_de_champ != revision.types_de_champ || types_de_champ_private != revision.types_de_champ_private
end

View file

@ -169,7 +169,7 @@ describe ProcedureRevision do
expect(new_revision.revision_types_de_champ.last.position).to eq(2)
expect(new_revision.revision_types_de_champ.last.type_de_champ).to eq(new_type_de_champ)
expect(new_revision.revision_types_de_champ.last.type_de_champ.revision).to eq(new_revision)
expect(procedure.active_revision.changed?(new_revision)).to be_truthy
expect(procedure.active_revision.different_from?(new_revision)).to be_truthy
expect(procedure.active_revision.compare(new_revision)).to eq([
{
op: :add,