From 9475cfc50b3d417cda19048c6da7c442c99e1075 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Wed, 25 Jan 2023 16:06:41 +0000 Subject: [PATCH] refactor: pratical -> practical --- .../sales/sale_information_validations.rb | 2 +- .../sales/sale_information_validations_spec.rb | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/validations/sales/sale_information_validations.rb b/app/models/validations/sales/sale_information_validations.rb index 8e0a56684..0f713f289 100644 --- a/app/models/validations/sales/sale_information_validations.rb +++ b/app/models/validations/sales/sale_information_validations.rb @@ -7,7 +7,7 @@ module Validations::Sales::SaleInformationValidations end end - def validate_pratical_completion_date_before_exdate(record) + def validate_practical_completion_date_before_exdate(record) return if record.exdate.blank? || record.hodate.blank? unless record.exdate > record.hodate diff --git a/spec/models/validations/sales/sale_information_validations_spec.rb b/spec/models/validations/sales/sale_information_validations_spec.rb index 34a4d1495..51bba9dd2 100644 --- a/spec/models/validations/sales/sale_information_validations_spec.rb +++ b/spec/models/validations/sales/sale_information_validations_spec.rb @@ -47,12 +47,12 @@ RSpec.describe Validations::Sales::SaleInformationValidations do end end - describe "#validate_pratical_completion_date_before_exdate" do + describe "#validate_practical_completion_date_before_exdate" do context "when hodate blank" do let(:record) { build(:sales_log, hodate: nil) } it "does not add an error" do - sale_information_validator.validate_pratical_completion_date_before_exdate(record) + sale_information_validator.validate_practical_completion_date_before_exdate(record) expect(record.errors).not_to be_present end @@ -62,7 +62,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do let(:record) { build(:sales_log, exdate: nil) } it "does not add an error" do - sale_information_validator.validate_pratical_completion_date_before_exdate(record) + sale_information_validator.validate_practical_completion_date_before_exdate(record) expect(record.errors).not_to be_present end @@ -72,7 +72,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do let(:record) { build(:sales_log, hodate: nil, exdate: nil) } it "does not add an error" do - sale_information_validator.validate_pratical_completion_date_before_exdate(record) + sale_information_validator.validate_practical_completion_date_before_exdate(record) expect(record.errors).not_to be_present end @@ -82,7 +82,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do let(:record) { build(:sales_log, hodate: 2.months.ago, exdate: 1.month.ago) } it "does not add the error" do - sale_information_validator.validate_pratical_completion_date_before_exdate(record) + sale_information_validator.validate_practical_completion_date_before_exdate(record) expect(record.errors).not_to be_present end @@ -92,7 +92,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do let(:record) { build(:sales_log, hodate: 1.month.ago, exdate: 2.months.ago) } it "adds error" do - sale_information_validator.validate_pratical_completion_date_before_exdate(record) + sale_information_validator.validate_practical_completion_date_before_exdate(record) expect(record.errors[:hodate]).to be_present end @@ -102,7 +102,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do let(:record) { build(:sales_log, hodate: Time.zone.parse("2023-07-01"), exdate: Time.zone.parse("2023-07-01")) } it "does not add an error" do - sale_information_validator.validate_pratical_completion_date_before_exdate(record) + sale_information_validator.validate_practical_completion_date_before_exdate(record) expect(record.errors[:hodate]).to be_present end