Browse Source

rubocop

pull/64/head
magicmilo 3 years ago
parent
commit
ede51029e9
  1. 2
      app/models/case_log.rb
  2. 4
      spec/models/case_log_spec.rb

2
app/models/case_log.rb

@ -61,7 +61,7 @@ class CaseLogValidator < ActiveModel::Validator
record.errors.add :armed_forces_active, "You must answer the armed forces active question if the tenant has served as a regular in the armed forces"
end
if record.armed_forces != "Yes - a regular" && !record.armed_forces_active.blank?
if record.armed_forces != "Yes - a regular" && record.armed_forces_active.present?
record.errors.add :armed_forces_active, "You must not answer the armed forces active question if the tenant has not served as a regular in the armed forces"
end
end

4
spec/models/case_log_spec.rb

@ -109,7 +109,7 @@ RSpec.describe Form, type: :model do
expect {
CaseLog.create!(armed_forces: "No",
armed_forces_active: "Yes")
}.to raise_error()
}.to raise_error
end
# Crossover over tests here as injured must be answered as well for no error
@ -118,7 +118,7 @@ RSpec.describe Form, type: :model do
CaseLog.create!(armed_forces: "Yes - a regular",
armed_forces_active: "Yes",
armed_forces_injured: "Yes")
}.not_to raise_error()
}.not_to raise_error
end
end
end

Loading…
Cancel
Save