|
|
|
@ -113,6 +113,22 @@ RSpec.describe Validations::Sales::FinancialValidations do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "#validate_mortgage" do |
|
|
|
|
|
|
|
let(:record) { FactoryBot.create(:sales_log) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "adds an error is the mortgage is zero" do |
|
|
|
|
|
|
|
record.mortgage = 0 |
|
|
|
|
|
|
|
financial_validator.validate_mortgage(record) |
|
|
|
|
|
|
|
expect(record.errors[:mortgage]).to include I18n.t("validations.financial.mortgage") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not add an error is the mortgage is positive" do |
|
|
|
|
|
|
|
record.mortgage = 234 |
|
|
|
|
|
|
|
financial_validator.validate_mortgage(record) |
|
|
|
|
|
|
|
expect(record.errors).to be_empty |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#validate_cash_discount" do |
|
|
|
describe "#validate_cash_discount" do |
|
|
|
let(:record) { FactoryBot.create(:sales_log) } |
|
|
|
let(:record) { FactoryBot.create(:sales_log) } |
|
|
|
|
|
|
|
|
|
|
|
|