From 9387a743da4063ce0e8b4a9cc047c9d99e8bd0cb Mon Sep 17 00:00:00 2001 From: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Date: Fri, 1 Apr 2022 15:22:03 +0100 Subject: [PATCH] Remove unused methods (#443) * Remove unused methods * Spec setting data protection officer status --- app/models/case_log.rb | 16 ---------------- spec/models/user_spec.rb | 11 ++++++++--- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 76c47297c..ae44e1f40 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -124,10 +124,6 @@ class CaseLog < ApplicationRecord net_income_in_soft_min_range? || net_income_in_soft_max_range? end - def rent_in_soft_validation_range? - rent_in_soft_min_range? || rent_in_soft_max_range? - end - def given_reasonable_preference? reasonpref == 1 end @@ -277,22 +273,10 @@ class CaseLog < ApplicationRecord landlord == 1 end - def other_landlord? - landlord == 2 - end - def is_prevten_la_general_needs? [30, 31].any?(prevten) end - def soft_min - LaRentRange.find_by(start_year: collection_start_year, la:, beds:, lettype:).soft_min - end - - def soft_max - LaRentRange.find_by(start_year: collection_start_year, la:, beds:, lettype:).soft_max - end - def self.to_csv CSV.generate(headers: true) do |csv| csv << attribute_names diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 275bb540c..ec0ffe4fb 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -51,13 +51,18 @@ RSpec.describe User, type: :model do expect(user.is_key_contact?).to be false end + it "can be set to key contact" do + expect { user.is_key_contact! } + .to change { user.reload.is_key_contact? }.from(false).to(true) + end + it "is not a data protection officer by default" do expect(user.is_data_protection_officer?).to be false end - it "can be set to key contact" do - expect { user.is_key_contact! } - .to change { user.reload.is_key_contact? }.from(false).to(true) + it "can be set to data protection officer" do + expect { user.is_data_protection_officer! } + .to change { user.reload.is_data_protection_officer? }.from(false).to(true) end end