From ede51029e9c6a40c61bbfcf346aeb4cbd0e2a8e4 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Tue, 26 Oct 2021 16:06:56 +0100 Subject: [PATCH] rubocop --- app/models/case_log.rb | 2 +- spec/helpers/check_answers_helper_spec.rb | 4 ++-- spec/models/case_log_spec.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index f56f20e2f..9e5f4e453 100644 --- a/app/models/case_log.rb +++ b/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 diff --git a/spec/helpers/check_answers_helper_spec.rb b/spec/helpers/check_answers_helper_spec.rb index e53c54957..cac582f93 100644 --- a/spec/helpers/check_answers_helper_spec.rb +++ b/spec/helpers/check_answers_helper_spec.rb @@ -12,8 +12,8 @@ RSpec.describe CheckAnswersHelper do end let(:case_log_with_met_radio_condition) do FactoryBot.create(:case_log, armed_forces: "Yes - a regular", - armed_forces_injured: "No", - armed_forces_active: "Yes") + armed_forces_injured: "No", + armed_forces_active: "Yes") end let(:subsection) { "income_and_benefits" } let(:subsection_with_numeric_conditionals) { "household_characteristics" } diff --git a/spec/models/case_log_spec.rb b/spec/models/case_log_spec.rb index 5fcb41bec..3907a8176 100644 --- a/spec/models/case_log_spec.rb +++ b/spec/models/case_log_spec.rb @@ -109,16 +109,16 @@ 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 + # Crossover over tests here as injured must be answered as well for no error it "must be answered if ever served in the forces as a regular" do expect { 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