Browse Source

Fix model tests and lint offences

pull/2553/head
Manny Dinssa 2 years ago
parent
commit
6b2180726a
  1. 4
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 8
      spec/models/form/sales/questions/privacy_notice_spec.rb

4
app/services/bulk_upload/lettings/year2024/row_parser.rb

@ -806,8 +806,8 @@ private
if setup_question?(question) if setup_question?(question)
fields.each do |field| fields.each do |field|
if errors.select { |e| fields.include?(e.attribute) }.none? if errors.select { |e| fields.include?(e.attribute) }.none? && field.present?
errors.add(field, question.unanswered_error_message, category: :setup) if field.present? errors.add(field, question.unanswered_error_message, category: :setup)
end end
end end
else else

8
spec/models/form/sales/questions/privacy_notice_spec.rb

@ -60,7 +60,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
end end
it "returns correct unanswered_error_message" do it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyer before you can submit this log.") expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyer before you can submit this log")
end end
end end
@ -78,7 +78,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
end end
it "returns correct unanswered_error_message" do it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyers before you can submit this log.") expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyers before you can submit this log")
end end
end end
end end
@ -100,7 +100,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
end end
it "returns correct unanswered_error_message" do it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyer before you can submit this log.") expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyer before you can submit this log")
end end
end end
@ -118,7 +118,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
end end
it "returns correct unanswered_error_message" do it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyers before you can submit this log.") expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyers before you can submit this log")
end end
end end
end end

Loading…
Cancel
Save