validate :cannot_modify_if_locked, on: :update
def cannot_modify_if_locked
if self.locked
errors.add(:locked_at, "#{self.locked_at} and cannot be modified")
false
end
RSPEC
consent_form = build(:consent_form, { locked_at: Date.today })
expect(consent_form.).to eq true
This test is not good. how to write this test? i need to check with rspec this validation on update
Aucun commentaire:
Enregistrer un commentaire