mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-08 14:15:35 +08:00
Fix form_field_value validation and specs
This commit is contained in:
parent
171cb933f3
commit
a45a9e9aca
2 changed files with 3 additions and 3 deletions
|
@ -40,7 +40,7 @@ class FormFieldValue < ApplicationRecord
|
|||
end
|
||||
|
||||
def uniqueness_latest
|
||||
return unless form_response.form_field_values.exists?(form_field_id: form_field_id, latest: true)
|
||||
return unless form_response&.form_field_values&.exists?(form_field_id: form_field_id, latest: true)
|
||||
|
||||
errors.add(:value, :not_unique_latest)
|
||||
end
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe FormFieldValue, type: :model do
|
||||
let(:form_response) { build :form_field_value }
|
||||
let(:form_field_value) { build :form_field_value }
|
||||
|
||||
it 'is valid' do
|
||||
expect(form_response).to be_valid
|
||||
expect(form_field_value).to be_valid
|
||||
end
|
||||
|
||||
it 'should be of class form field value' do
|
||||
|
|
Loading…
Add table
Reference in a new issue