Skip to content

Commit

Permalink
fix models specs
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamfall committed Nov 6, 2023
1 parent cfeb71b commit cc9ccec
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/models/form_answer_attachment.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class FormAnswerAttachment < ApplicationRecord
belongs_to :form_answer
belongs_to :attachable, polymorphic: true
belongs_to :attachable, polymorphic: true, optional: true

mount_uploader :file, FormAnswerAttachmentUploader
scan_file :file
Expand Down
2 changes: 1 addition & 1 deletion app/models/support_letter_attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SupportLetterAttachment < ApplicationRecord
begin :associations
belongs_to :user
belongs_to :form_answer
belongs_to :support_letter
belongs_to :support_letter, optional: true
end

begin :validations
Expand Down
2 changes: 1 addition & 1 deletion app/validators/file_size_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def validate_each(record, attribute, value)
default_message = options[MESSAGES[key]]
errors_options[:message] ||= default_message if default_message

record.errors.add(attribute, MESSAGES[key], errors_options)
record.errors.add(attribute, MESSAGES[key], **errors_options)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/assessor_assignment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end
it "is invalid" do
expect(subject).to_not be_valid
expect(subject.errors.keys).to include(:verdict_rate)
expect(subject.errors.attribute_names).to include(:verdict_rate)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/eligibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

describe Eligibility do

it {is_expected.to belong_to(:account)}
it {is_expected.to belong_to(:form_answer)}
it { is_expected.to belong_to(:account) }
it { is_expected.to belong_to(:form_answer).optional }

describe 'base validation' do
it 'should raise error' do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/group_leader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
subject {build(:group_leader)}

describe "associations" do
it { should belong_to(:form_answer) }
it { should belong_to(:form_answer).optional }
end

it 'has valid a factory' do
Expand Down

0 comments on commit cc9ccec

Please sign in to comment.