outstanding_amount_not_required:"You must not answer the outstanding amount question if you don’t have outstanding rent or charges."
outstanding_amount_not_required:"You must not answer the outstanding amount question if you don’t have outstanding rent or charges"
more_than_rent:"Answer must be less than half of the basic rent amount"
hbrentshortfall:
hbrentshortfall:
outstanding_no_benefits:"Outstanding amount for basic rent and/or benefit eligible charges cannot be 'Yes' if tenant is not in receipt of housing benefit or universal benefit or if benefit is unknown"
outstanding_no_benefits:"Outstanding amount for basic rent and/or benefit eligible charges cannot be 'Yes' if tenant is not in receipt of housing benefit or universal benefit or if benefit is unknown"
benefits:
benefits:
@ -94,6 +95,33 @@ en:
freq_missing:"Select how often the household receives income"
freq_missing:"Select how often the household receives income"
earnings_missing:"Enter how much income the household has in total"
earnings_missing:"Enter how much income the household has in total"
negative_currency:"Enter an amount above 0"
negative_currency:"Enter an amount above 0"
rent:
less_than_double_shortfall:"Answer must be more than double the shortfall in basic rent"
scharge:
this_landlord:
general_needs:"Service charge must be between £0 and £55 per week if the landlord is this landlord and it is a general needs letting"
supported_housing:"Service charge must be between £0 and £280 per week if the landlord is this landlord and it is a suported housing letting"
other_landlord:
general_needs:"Service charge must be between £0 and £45 per week if the landlord is another RP and it is a general needs letting"
supported_housing:"Service charge must be between £0 and £165 per week if the landlord is another RP and it is a suported housing letting"
pscharge:
this_landlord:
general_needs:"Personal service charge must be between £0 and £30 per week if the landlord is this landlord and it is a general needs letting"
supported_housing:"Personal service charge must be between £0 and £200 per week if the landlord is this landlord and it is a suported housing letting"
other_landlord:
general_needs:"Personal service charge must be between £0 and £35 per week if the landlord is another RP and it is a general needs letting"
supported_housing:"Personal service charge must be between £0 and £75 per week if the landlord is another RP and it is a suported housing letting"
supcharg:
this_landlord:
general_needs:"Support charge must be between £0 and £40 per week if the landlord is this landlord and it is a general needs letting"
supported_housing:"Support charge must be between £0 and £465 per week if the landlord is this landlord and it is a suported housing letting"
other_landlord:
general_needs:"Support charge must be between £0 and £60 per week if the landlord is another RP and it is a general needs letting"
supported_housing:"Support charge must be between £0 and £120 per week if the landlord is another RP and it is a suported housing letting"
charges:
complete_1_of_3:'Only one question out of "Total charge", "Charges for carehomes" and "Does the household pay rent or charges?" needs to be selected and completed'
tcharge:
under_10:"Total charge must be at least £10 per week"
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(50.06)
expect(case_log.wpschrge).toeq(50.07)
expect(case_log.wscharge).toeq(50.49)
expect(case_log.wrent).toeq(50.49)
expect(case_log.wtcharge).toeq(201.1)
expect(record_from_db["wsupchrg"]).toeq(50.06)
expect(record_from_db["wpschrge"]).toeq(50.07)
expect(record_from_db["wscharge"]).toeq(50.49)
expect(record_from_db["wrent"]).toeq(50.49)
expect(record_from_db["wtcharge"]).toeq(201.1)
end
end
end
context"when rent is paid every 4 weeks"do
context"when rent is paid every 4 weeks"do
it"correctly derives and saves weekly rent"do
it"correctly derives and saves weekly rent"do
case_log.update!(brent:120,period:1)
case_log.update!(brent:120,period:3)
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wrent).toeq(30.0)
expect(case_log.wrent).toeq(30.0)
expect(record_from_db["wrent"]).toeq(30.0)
expect(record_from_db["wrent"]).toeq(30.0)
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:120,period:1)
case_log.update!(scharge:120,period:3)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(30.0)
expect(case_log.wscharge).toeq(30.0)
expect(record_from_db["wscharge"]).toeq(30.0)
expect(record_from_db["wscharge"]).toeq(30.0)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:120,period:1)
case_log.update!(pscharge:120,period:3)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(30.0)
expect(case_log.wpschrge).toeq(30.0)
expect(record_from_db["wpschrge"]).toeq(30.0)
expect(record_from_db["wpschrge"]).toeq(30.0)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:120,period:1)
case_log.update!(supcharg:120,period:3)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(30.0)
expect(case_log.wsupchrg).toeq(30.0)
expect(record_from_db["wsupchrg"]).toeq(30.0)
expect(record_from_db["wsupchrg"]).toeq(30.0)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
case_log.update!(tcharge:120,period:1)
case_log.update!(tcharge:120,period:3)
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wtcharge).toeq(30.0)
expect(case_log.wtcharge).toeq(30.0)
expect(record_from_db["wtcharge"]).toeq(30.0)
expect(record_from_db["wtcharge"]).toeq(30.0)
@ -417,7 +432,7 @@ RSpec.describe CaseLog do
context"when the tenant has an outstanding amount after benefits"do
context"when the tenant has an outstanding amount after benefits"do
context"when tenant is in receipt of housing benefit"do
context"when tenant is in receipt of housing benefit"do
it"correctly derives and saves weekly total shortfall"do
it"correctly derives and saves weekly total shortfall"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(25.03)
expect(case_log.wpschrge).toeq(25.03)
expect(case_log.wscharge).toeq(25.24)
expect(case_log.wrent).toeq(25.24)
expect(case_log.wtcharge).toeq(100.55)
expect(record_from_db["wsupchrg"]).toeq(25.03)
expect(record_from_db["wpschrge"]).toeq(25.03)
expect(record_from_db["wscharge"]).toeq(25.24)
expect(record_from_db["wrent"]).toeq(25.24)
expect(record_from_db["wtcharge"]).toeq(100.55)
end
end
end
context"when rent is paid every calendar month"do
context"when rent is paid every calendar month"do
it"correctly derives and saves weekly rent"do
it"correctly derives and saves weekly rent"do
case_log.update!(brent:130,period:2)
case_log.update!(brent:130,period:4)
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wrent).toeq(30.0)
expect(case_log.wrent).toeq(30.0)
expect(record_from_db["wrent"]).toeq(30.0)
expect(record_from_db["wrent"]).toeq(30.0)
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:2)
case_log.update!(scharge:130,period:4)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(30.0)
expect(case_log.wscharge).toeq(30.0)
expect(record_from_db["wscharge"]).toeq(30.0)
expect(record_from_db["wscharge"]).toeq(30.0)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:2)
case_log.update!(pscharge:130,period:4)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(30.0)
expect(case_log.wpschrge).toeq(30.0)
expect(record_from_db["wpschrge"]).toeq(30.0)
expect(record_from_db["wpschrge"]).toeq(30.0)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:2)
case_log.update!(supcharg:130,period:4)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(30.0)
expect(case_log.wsupchrg).toeq(30.0)
expect(record_from_db["wsupchrg"]).toeq(30.0)
expect(record_from_db["wsupchrg"]).toeq(30.0)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
case_log.update!(tcharge:130,period:2)
case_log.update!(tcharge:130,period:4)
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wtcharge).toeq(30.0)
expect(case_log.wtcharge).toeq(30.0)
expect(record_from_db["wtcharge"]).toeq(30.0)
expect(record_from_db["wtcharge"]).toeq(30.0)
@ -483,7 +513,7 @@ RSpec.describe CaseLog do
context"when the tenant has an outstanding amount after benefits"do
context"when the tenant has an outstanding amount after benefits"do
context"when tenant is in receipt of housing benefit"do
context"when tenant is in receipt of housing benefit"do
it"correctly derives and saves weekly total shortfall"do
it"correctly derives and saves weekly total shortfall"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(23.10)
expect(case_log.wpschrge).toeq(23.11)
expect(case_log.wscharge).toeq(23.30)
expect(case_log.wrent).toeq(23.30)
expect(case_log.wtcharge).toeq(92.82)
expect(record_from_db["wsupchrg"]).toeq(23.10)
expect(record_from_db["wpschrge"]).toeq(23.11)
expect(record_from_db["wscharge"]).toeq(23.30)
expect(record_from_db["wrent"]).toeq(23.30)
expect(record_from_db["wtcharge"]).toeq(92.82)
end
end
end
context"when rent is paid weekly for 50 weeks"do
context"when rent is paid weekly for 50 weeks"do
it"correctly derives and saves weekly rent"do
it"correctly derives and saves weekly rent"do
case_log.update!(brent:130,period:3)
case_log.update!(brent:130,period:5)
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wrent).toeq(125.0)
expect(case_log.wrent).toeq(125.0)
expect(record_from_db["wrent"]).toeq(125.0)
expect(record_from_db["wrent"]).toeq(125.0)
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:3)
case_log.update!(scharge:130,period:5)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(125.0)
expect(case_log.wscharge).toeq(125.0)
expect(record_from_db["wscharge"]).toeq(125.0)
expect(record_from_db["wscharge"]).toeq(125.0)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:3)
case_log.update!(pscharge:130,period:5)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(125.0)
expect(case_log.wpschrge).toeq(125.0)
expect(record_from_db["wpschrge"]).toeq(125.0)
expect(record_from_db["wpschrge"]).toeq(125.0)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:3)
case_log.update!(supcharg:130,period:5)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(125.0)
expect(case_log.wsupchrg).toeq(125.0)
expect(record_from_db["wsupchrg"]).toeq(125.0)
expect(record_from_db["wsupchrg"]).toeq(125.0)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
case_log.update!(tcharge:130,period:3)
case_log.update!(tcharge:130,period:5)
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wtcharge).toeq(125.0)
expect(case_log.wtcharge).toeq(125.0)
expect(record_from_db["wtcharge"]).toeq(125.0)
expect(record_from_db["wtcharge"]).toeq(125.0)
@ -549,7 +594,7 @@ RSpec.describe CaseLog do
context"when the tenant has an outstanding amount after benefits"do
context"when the tenant has an outstanding amount after benefits"do
context"when tenant is in receipt of housing benefit"do
context"when tenant is in receipt of housing benefit"do
it"correctly derives and saves weekly total shortfall"do
it"correctly derives and saves weekly total shortfall"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(96.27)
expect(case_log.wpschrge).toeq(96.28)
expect(case_log.wscharge).toeq(97.1)
expect(case_log.wrent).toeq(97.09)
expect(case_log.wtcharge).toeq(386.73)
expect(record_from_db["wsupchrg"]).toeq(96.27)
expect(record_from_db["wpschrge"]).toeq(96.28)
expect(record_from_db["wscharge"]).toeq(97.1)
expect(record_from_db["wrent"]).toeq(97.09)
expect(record_from_db["wtcharge"]).toeq(386.73)
end
end
end
context"when rent is paid weekly for 49 weeks"do
context"when rent is paid weekly for 49 weeks"do
it"correctly derives and saves weekly rent"do
it"correctly derives and saves weekly rent"do
case_log.update!(brent:130,period:4)
case_log.update!(brent:130,period:6)
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wrent).toeq(122.5)
expect(case_log.wrent).toeq(122.5)
expect(record_from_db["wrent"]).toeq(122.5)
expect(record_from_db["wrent"]).toeq(122.5)
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:4)
case_log.update!(scharge:130,period:6)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(122.5)
expect(case_log.wscharge).toeq(122.5)
expect(record_from_db["wscharge"]).toeq(122.5)
expect(record_from_db["wscharge"]).toeq(122.5)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:4)
case_log.update!(pscharge:130,period:6)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(122.5)
expect(case_log.wpschrge).toeq(122.5)
expect(record_from_db["wpschrge"]).toeq(122.5)
expect(record_from_db["wpschrge"]).toeq(122.5)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:4)
case_log.update!(supcharg:130,period:6)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(122.5)
expect(case_log.wsupchrg).toeq(122.5)
expect(record_from_db["wsupchrg"]).toeq(122.5)
expect(record_from_db["wsupchrg"]).toeq(122.5)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
case_log.update!(tcharge:130,period:4)
case_log.update!(tcharge:130,period:6)
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wtcharge).toeq(122.5)
expect(case_log.wtcharge).toeq(122.5)
expect(record_from_db["wtcharge"]).toeq(122.5)
expect(record_from_db["wtcharge"]).toeq(122.5)
@ -615,7 +675,7 @@ RSpec.describe CaseLog do
context"when the tenant has an outstanding amount after benefits"do
context"when the tenant has an outstanding amount after benefits"do
context"when tenant is in receipt of housing benefit"do
context"when tenant is in receipt of housing benefit"do
it"correctly derives and saves weekly total shortfall"do
it"correctly derives and saves weekly total shortfall"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(94.34)
expect(case_log.wpschrge).toeq(94.35)
expect(case_log.wscharge).toeq(95.15)
expect(case_log.wrent).toeq(95.14)
expect(case_log.wtcharge).toeq(379)
expect(record_from_db["wsupchrg"]).toeq(94.34)
expect(record_from_db["wpschrge"]).toeq(94.35)
expect(record_from_db["wscharge"]).toeq(95.15)
expect(record_from_db["wrent"]).toeq(95.14)
expect(record_from_db["wtcharge"]).toeq(379)
end
end
end
context"when rent is paid weekly for 48 weeks"do
context"when rent is paid weekly for 48 weeks"do
it"correctly derives and saves weekly rent"do
it"correctly derives and saves weekly rent"do
case_log.update!(brent:130,period:5)
case_log.update!(brent:130,period:7)
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wrent).toeq(120.0)
expect(case_log.wrent).toeq(120.0)
expect(record_from_db["wrent"]).toeq(120.0)
expect(record_from_db["wrent"]).toeq(120.0)
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:5)
case_log.update!(scharge:130,period:7)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(120.0)
expect(case_log.wscharge).toeq(120.0)
expect(record_from_db["wscharge"]).toeq(120.0)
expect(record_from_db["wscharge"]).toeq(120.0)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:5)
case_log.update!(pscharge:130,period:7)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(120.0)
expect(case_log.wpschrge).toeq(120.0)
expect(record_from_db["wpschrge"]).toeq(120.0)
expect(record_from_db["wpschrge"]).toeq(120.0)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:5)
case_log.update!(supcharg:130,period:7)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(120.0)
expect(case_log.wsupchrg).toeq(120.0)
expect(record_from_db["wsupchrg"]).toeq(120.0)
expect(record_from_db["wsupchrg"]).toeq(120.0)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
case_log.update!(tcharge:130,period:5)
case_log.update!(tcharge:130,period:7)
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wtcharge).toeq(120.0)
expect(case_log.wtcharge).toeq(120.0)
expect(record_from_db["wtcharge"]).toeq(120.0)
expect(record_from_db["wtcharge"]).toeq(120.0)
@ -681,7 +756,7 @@ RSpec.describe CaseLog do
context"when the tenant has an outstanding amount after benefits"do
context"when the tenant has an outstanding amount after benefits"do
context"when tenant is in receipt of housing benefit"do
context"when tenant is in receipt of housing benefit"do
it"correctly derives and saves weekly total shortfall"do
it"correctly derives and saves weekly total shortfall"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(92.42)
expect(case_log.wpschrge).toeq(92.43)
expect(case_log.wscharge).toeq(93.21)
expect(case_log.wrent).toeq(93.20)
expect(case_log.wtcharge).toeq(371.26)
expect(record_from_db["wsupchrg"]).toeq(92.42)
expect(record_from_db["wpschrge"]).toeq(92.43)
expect(record_from_db["wscharge"]).toeq(93.21)
expect(record_from_db["wrent"]).toeq(93.20)
expect(record_from_db["wtcharge"]).toeq(371.26)
end
end
end
context"when rent is paid weekly for 47 weeks"do
context"when rent is paid weekly for 47 weeks"do
it"correctly derives and saves weekly rent"do
it"correctly derives and saves weekly rent"do
case_log.update!(brent:130,period:6)
case_log.update!(brent:130,period:8)
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wrent).toeq(117.5)
expect(case_log.wrent).toeq(117.5)
expect(record_from_db["wrent"]).toeq(117.5)
expect(record_from_db["wrent"]).toeq(117.5)
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:6)
case_log.update!(scharge:130,period:8)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(117.5)
expect(case_log.wscharge).toeq(117.5)
expect(record_from_db["wscharge"]).toeq(117.5)
expect(record_from_db["wscharge"]).toeq(117.5)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:6)
case_log.update!(pscharge:130,period:8)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(117.5)
expect(case_log.wpschrge).toeq(117.5)
expect(record_from_db["wpschrge"]).toeq(117.5)
expect(record_from_db["wpschrge"]).toeq(117.5)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:6)
case_log.update!(supcharg:130,period:8)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(117.5)
expect(case_log.wsupchrg).toeq(117.5)
expect(record_from_db["wsupchrg"]).toeq(117.5)
expect(record_from_db["wsupchrg"]).toeq(117.5)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
case_log.update!(tcharge:130,period:6)
case_log.update!(tcharge:130,period:8)
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wtcharge).toeq(117.5)
expect(case_log.wtcharge).toeq(117.5)
expect(record_from_db["wtcharge"]).toeq(117.5)
expect(record_from_db["wtcharge"]).toeq(117.5)
@ -747,7 +837,7 @@ RSpec.describe CaseLog do
context"when the tenant has an outstanding amount after benefits"do
context"when the tenant has an outstanding amount after benefits"do
context"when tenant is in receipt of housing benefit"do
context"when tenant is in receipt of housing benefit"do
it"correctly derives and saves weekly total shortfall"do
it"correctly derives and saves weekly total shortfall"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(90.49)
expect(case_log.wpschrge).toeq(90.50)
expect(case_log.wscharge).toeq(91.27)
expect(case_log.wrent).toeq(91.26)
expect(case_log.wtcharge).toeq(363.53)
expect(record_from_db["wsupchrg"]).toeq(90.49)
expect(record_from_db["wpschrge"]).toeq(90.50)
expect(record_from_db["wscharge"]).toeq(91.27)
expect(record_from_db["wrent"]).toeq(91.26)
expect(record_from_db["wtcharge"]).toeq(363.53)
end
end
end
context"when rent is paid weekly for 46 weeks"do
context"when rent is paid weekly for 46 weeks"do
it"correctly derives and saves weekly rent"do
it"correctly derives and saves weekly rent"do
case_log.update!(brent:130,period:7)
case_log.update!(brent:130,period:9)
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wrent).toeq(115.0)
expect(case_log.wrent).toeq(115.0)
expect(record_from_db["wrent"]).toeq(115.0)
expect(record_from_db["wrent"]).toeq(115.0)
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:7)
case_log.update!(scharge:130,period:9)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(115.0)
expect(case_log.wscharge).toeq(115.0)
expect(record_from_db["wscharge"]).toeq(115.0)
expect(record_from_db["wscharge"]).toeq(115.0)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:7)
case_log.update!(pscharge:130,period:9)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(115.0)
expect(case_log.wpschrge).toeq(115.0)
expect(record_from_db["wpschrge"]).toeq(115.0)
expect(record_from_db["wpschrge"]).toeq(115.0)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:7)
case_log.update!(supcharg:130,period:9)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(115.0)
expect(case_log.wsupchrg).toeq(115.0)
expect(record_from_db["wsupchrg"]).toeq(115.0)
expect(record_from_db["wsupchrg"]).toeq(115.0)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
case_log.update!(tcharge:130,period:7)
case_log.update!(tcharge:130,period:9)
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wtcharge).toeq(115.0)
expect(case_log.wtcharge).toeq(115.0)
expect(record_from_db["wtcharge"]).toeq(115.0)
expect(record_from_db["wtcharge"]).toeq(115.0)
@ -813,7 +918,7 @@ RSpec.describe CaseLog do
context"when the tenant has an outstanding amount after benefits"do
context"when the tenant has an outstanding amount after benefits"do
context"when tenant is in receipt of housing benefit"do
context"when tenant is in receipt of housing benefit"do
it"correctly derives and saves weekly total shortfall"do
it"correctly derives and saves weekly total shortfall"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(88.57)
expect(case_log.wpschrge).toeq(88.58)
expect(case_log.wscharge).toeq(89.33)
expect(case_log.wrent).toeq(89.32)
expect(case_log.wtcharge).toeq(355.79)
expect(record_from_db["wsupchrg"]).toeq(88.57)
expect(record_from_db["wpschrge"]).toeq(88.58)
expect(record_from_db["wscharge"]).toeq(89.33)
expect(record_from_db["wrent"]).toeq(89.32)
expect(record_from_db["wtcharge"]).toeq(355.79)
end
end
end
context"when rent is paid weekly for 52 weeks"do
context"when rent is paid weekly for 52 weeks"do
it"correctly derives and saves weekly rent"do
it"correctly derives and saves weekly rent"do
case_log.update!(brent:130,period:8)
case_log.update!(brent:130,period:1)
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wrent).toeq(130.0)
expect(case_log.wrent).toeq(130.0)
expect(record_from_db["wrent"]).toeq(130.0)
expect(record_from_db["wrent"]).toeq(130.0)
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:8)
case_log.update!(scharge:130,period:1)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(130.0)
expect(case_log.wscharge).toeq(130.0)
expect(record_from_db["wscharge"]).toeq(130.0)
expect(record_from_db["wscharge"]).toeq(130.0)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:8)
case_log.update!(pscharge:130,period:1)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(130.0)
expect(case_log.wpschrge).toeq(130.0)
expect(record_from_db["wpschrge"]).toeq(130.0)
expect(record_from_db["wpschrge"]).toeq(130.0)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:8)
case_log.update!(supcharg:130,period:1)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(130.0)
expect(case_log.wsupchrg).toeq(130.0)
expect(record_from_db["wsupchrg"]).toeq(130.0)
expect(record_from_db["wsupchrg"]).toeq(130.0)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
case_log.update!(tcharge:130,period:8)
case_log.update!(tcharge:130,period:1)
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wtcharge).toeq(130.0)
expect(case_log.wtcharge).toeq(130.0)
expect(record_from_db["wtcharge"]).toeq(130.0)
expect(record_from_db["wtcharge"]).toeq(130.0)
@ -879,7 +999,7 @@ RSpec.describe CaseLog do
context"when the tenant has an outstanding amount after benefits"do
context"when the tenant has an outstanding amount after benefits"do
context"when tenant is in receipt of housing benefit"do
context"when tenant is in receipt of housing benefit"do
it"correctly derives and saves weekly total shortfall"do
it"correctly derives and saves weekly total shortfall"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]