Browse Source

Update testst

pull/2249/head
Kat 2 years ago
parent
commit
ae2657219e
  1. 324
      spec/models/validations/soft_validations_spec.rb

324
spec/models/validations/soft_validations_spec.rb

@ -387,7 +387,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = 1 record.period = 1
expect(record).not_to be_scharge_over_soft_max expect(record).not_to be_scharge_in_soft_max_range
end end
it "returns false if period is not given" do it "returns false if period is not given" do
@ -395,7 +395,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = nil record.period = nil
expect(record).not_to be_scharge_over_soft_max expect(record).not_to be_scharge_in_soft_max_range
end end
[{ [{
@ -415,7 +415,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_scharge_over_soft_max expect(record).not_to be_scharge_in_soft_max_range
end end
end end
@ -436,7 +436,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_scharge_over_soft_max expect(record).not_to be_scharge_in_soft_max_range
end end
end end
@ -457,7 +457,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_scharge_over_soft_max expect(record).to be_scharge_in_soft_max_range
end end
end end
@ -478,7 +478,49 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_scharge_over_soft_max expect(record).to be_scharge_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
scharge: 801,
},
{
period: { label: "monthly", value: 4 },
scharge: 3471,
},
{
period: { label: "every 2 weeks", value: 2 },
scharge: 1601,
}].each do |test_case|
it "returns false if scharge is over hard max for general needs #{test_case[:period][:label]} (800)" do
record.scharge = test_case[:scharge]
record.needstype = 1
record.period = test_case[:period][:value]
expect(record).not_to be_scharge_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
scharge: 801,
},
{
period: { label: "monthly", value: 4 },
scharge: 3471,
},
{
period: { label: "every 2 weeks", value: 2 },
scharge: 1601,
}].each do |test_case|
it "returns false if scharge is over hard max for supported housing #{test_case[:period][:label]} (800)" do
record.scharge = test_case[:scharge]
record.needstype = 2
record.period = test_case[:period][:value]
expect(record).not_to be_scharge_in_soft_max_range
end end
end end
end end
@ -493,7 +535,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = 1 record.period = 1
expect(record).not_to be_scharge_over_soft_max expect(record).not_to be_scharge_in_soft_max_range
end end
it "returns false if period is not given" do it "returns false if period is not given" do
@ -501,7 +543,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = nil record.period = nil
expect(record).not_to be_scharge_over_soft_max expect(record).not_to be_scharge_in_soft_max_range
end end
[{ [{
@ -521,7 +563,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_scharge_over_soft_max expect(record).not_to be_scharge_in_soft_max_range
end end
end end
@ -542,7 +584,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_scharge_over_soft_max expect(record).not_to be_scharge_in_soft_max_range
end end
end end
@ -563,7 +605,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_scharge_over_soft_max expect(record).to be_scharge_in_soft_max_range
end end
end end
@ -584,7 +626,49 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_scharge_over_soft_max expect(record).to be_scharge_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
scharge: 501,
},
{
period: { label: "monthly", value: 4 },
scharge: 2167,
},
{
period: { label: "every 2 weeks", value: 2 },
scharge: 1001,
}].each do |test_case|
it "returns false if scharge is over hard max for general needs #{test_case[:period][:label]} (500)" do
record.scharge = test_case[:scharge]
record.needstype = 1
record.period = test_case[:period][:value]
expect(record).not_to be_scharge_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
scharge: 501,
},
{
period: { label: "monthly", value: 4 },
scharge: 2167,
},
{
period: { label: "every 2 weeks", value: 2 },
scharge: 1001,
}].each do |test_case|
it "returns false if scharge is over hard max for supported housing #{test_case[:period][:label]} (500)" do
record.scharge = test_case[:scharge]
record.needstype = 2
record.period = test_case[:period][:value]
expect(record).not_to be_scharge_in_soft_max_range
end end
end end
end end
@ -601,7 +685,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = 1 record.period = 1
expect(record).not_to be_pscharge_over_soft_max expect(record).not_to be_pscharge_in_soft_max_range
end end
it "returns false if period is not given" do it "returns false if period is not given" do
@ -609,7 +693,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = nil record.period = nil
expect(record).not_to be_pscharge_over_soft_max expect(record).not_to be_pscharge_in_soft_max_range
end end
[{ [{
@ -629,7 +713,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_pscharge_over_soft_max expect(record).not_to be_pscharge_in_soft_max_range
end end
end end
@ -650,7 +734,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_pscharge_over_soft_max expect(record).not_to be_pscharge_in_soft_max_range
end end
end end
@ -671,7 +755,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_pscharge_over_soft_max expect(record).to be_pscharge_in_soft_max_range
end end
end end
@ -692,7 +776,49 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_pscharge_over_soft_max expect(record).to be_pscharge_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
pscharge: 701,
},
{
period: { label: "monthly", value: 4 },
pscharge: 3034,
},
{
period: { label: "every 2 weeks", value: 2 },
pscharge: 1401,
}].each do |test_case|
it "returns false if pscharge is over hard max for general needs #{test_case[:period][:label]} (700)" do
record.pscharge = test_case[:pscharge]
record.needstype = 1
record.period = test_case[:period][:value]
expect(record).not_to be_pscharge_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
pscharge: 701,
},
{
period: { label: "monthly", value: 4 },
pscharge: 3034,
},
{
period: { label: "every 2 weeks", value: 2 },
pscharge: 1401,
}].each do |test_case|
it "returns true if pscharge is over hard max for supported housing #{test_case[:period][:label]} (700)" do
record.pscharge = test_case[:pscharge]
record.needstype = 2
record.period = test_case[:period][:value]
expect(record).not_to be_pscharge_in_soft_max_range
end end
end end
end end
@ -707,7 +833,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = 1 record.period = 1
expect(record).not_to be_pscharge_over_soft_max expect(record).not_to be_pscharge_in_soft_max_range
end end
it "returns false if period is not given" do it "returns false if period is not given" do
@ -715,7 +841,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = nil record.period = nil
expect(record).not_to be_pscharge_over_soft_max expect(record).not_to be_pscharge_in_soft_max_range
end end
[{ [{
@ -735,7 +861,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_pscharge_over_soft_max expect(record).not_to be_pscharge_in_soft_max_range
end end
end end
@ -756,7 +882,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_pscharge_over_soft_max expect(record).not_to be_pscharge_in_soft_max_range
end end
end end
@ -777,7 +903,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_pscharge_over_soft_max expect(record).to be_pscharge_in_soft_max_range
end end
end end
@ -798,7 +924,49 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_pscharge_over_soft_max expect(record).to be_pscharge_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
pscharge: 201,
},
{
period: { label: "monthly", value: 4 },
pscharge: 867,
},
{
period: { label: "every 2 weeks", value: 2 },
pscharge: 401,
}].each do |test_case|
it "returns false if pscharge is over hard max for general needs #{test_case[:period][:label]} (200)" do
record.pscharge = test_case[:pscharge]
record.needstype = 1
record.period = test_case[:period][:value]
expect(record).not_to be_pscharge_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
pscharge: 201,
},
{
period: { label: "monthly", value: 4 },
pscharge: 867,
},
{
period: { label: "every 2 weeks", value: 2 },
pscharge: 401,
}].each do |test_case|
it "returns false if pscharge is over hard max for supported housing #{test_case[:period][:label]} (200)" do
record.pscharge = test_case[:pscharge]
record.needstype = 2
record.period = test_case[:period][:value]
expect(record).not_to be_pscharge_in_soft_max_range
end end
end end
end end
@ -815,7 +983,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = 1 record.period = 1
expect(record).not_to be_supcharg_over_soft_max expect(record).not_to be_supcharg_in_soft_max_range
end end
it "returns false if period is not given" do it "returns false if period is not given" do
@ -823,7 +991,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = nil record.period = nil
expect(record).not_to be_supcharg_over_soft_max expect(record).not_to be_supcharg_in_soft_max_range
end end
[{ [{
@ -843,7 +1011,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_supcharg_over_soft_max expect(record).not_to be_supcharg_in_soft_max_range
end end
end end
@ -864,7 +1032,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_supcharg_over_soft_max expect(record).not_to be_supcharg_in_soft_max_range
end end
end end
@ -885,7 +1053,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_supcharg_over_soft_max expect(record).to be_supcharg_in_soft_max_range
end end
end end
@ -906,7 +1074,49 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_supcharg_over_soft_max expect(record).to be_supcharg_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
supcharg: 801,
},
{
period: { label: "monthly", value: 4 },
supcharg: 3467,
},
{
period: { label: "every 2 weeks", value: 2 },
supcharg: 1601,
}].each do |test_case|
it "returns false if supcharg is over hard max for general needs #{test_case[:period][:label]} (800)" do
record.supcharg = test_case[:supcharg]
record.needstype = 1
record.period = test_case[:period][:value]
expect(record).not_to be_supcharg_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
supcharg: 801,
},
{
period: { label: "monthly", value: 4 },
supcharg: 3467,
},
{
period: { label: "every 2 weeks", value: 2 },
supcharg: 1601,
}].each do |test_case|
it "returns false if supcharg is over hard max for supported housing #{test_case[:period][:label]} (800)" do
record.supcharg = test_case[:supcharg]
record.needstype = 2
record.period = test_case[:period][:value]
expect(record).not_to be_supcharg_in_soft_max_range
end end
end end
end end
@ -921,7 +1131,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = 1 record.period = 1
expect(record).not_to be_supcharg_over_soft_max expect(record).not_to be_supcharg_in_soft_max_range
end end
it "returns false if period is not given" do it "returns false if period is not given" do
@ -929,7 +1139,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = nil record.period = nil
expect(record).not_to be_supcharg_over_soft_max expect(record).not_to be_supcharg_in_soft_max_range
end end
[{ [{
@ -949,7 +1159,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_supcharg_over_soft_max expect(record).not_to be_supcharg_in_soft_max_range
end end
end end
@ -970,7 +1180,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).not_to be_supcharg_over_soft_max expect(record).not_to be_supcharg_in_soft_max_range
end end
end end
@ -991,7 +1201,7 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 1 record.needstype = 1
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_supcharg_over_soft_max expect(record).to be_supcharg_in_soft_max_range
end end
end end
@ -1012,7 +1222,49 @@ RSpec.describe Validations::SoftValidations do
record.needstype = 2 record.needstype = 2
record.period = test_case[:period][:value] record.period = test_case[:period][:value]
expect(record).to be_supcharg_over_soft_max expect(record).to be_supcharg_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
supcharg: 201,
},
{
period: { label: "monthly", value: 4 },
supcharg: 867,
},
{
period: { label: "every 2 weeks", value: 2 },
supcharg: 401,
}].each do |test_case|
it "returns false if supcharg is over hard max for general needs #{test_case[:period][:label]} (200)" do
record.supcharg = test_case[:supcharg]
record.needstype = 1
record.period = test_case[:period][:value]
expect(record).not_to be_supcharg_in_soft_max_range
end
end
[{
period: { label: "weekly", value: 1 },
supcharg: 201,
},
{
period: { label: "monthly", value: 4 },
supcharg: 867,
},
{
period: { label: "every 2 weeks", value: 2 },
supcharg: 401,
}].each do |test_case|
it "returns false if supcharg is over hard max for supported housing #{test_case[:period][:label]} (200)" do
record.supcharg = test_case[:supcharg]
record.needstype = 2
record.period = test_case[:period][:value]
expect(record).not_to be_supcharg_in_soft_max_range
end end
end end
end end

Loading…
Cancel
Save