|
|
|
|
@ -881,10 +881,8 @@ RSpec.describe Form, type: :model do
|
|
|
|
|
owning_organisation: organisation, |
|
|
|
|
property_postcode: "M1 1AE", |
|
|
|
|
previous_postcode: "M2 2AE", |
|
|
|
|
day: 10, |
|
|
|
|
month: 10, |
|
|
|
|
year: 2021, |
|
|
|
|
# rubocop:disable Style/DateTime |
|
|
|
|
startdate: DateTime.new(2021, 10, 10), |
|
|
|
|
mrcdate: DateTime.new(2021, 5, 4), |
|
|
|
|
# rubocop:enable Style/DateTime |
|
|
|
|
net_income_known: "Prefer not to say", |
|
|
|
|
@ -952,12 +950,16 @@ RSpec.describe Form, type: :model do
|
|
|
|
|
expect(record_from_db["lettype"]).to eq(9) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "correctly derives and saves startdate" do |
|
|
|
|
it "correctly derives and saves day, month, year from start date" do |
|
|
|
|
case_log.reload |
|
|
|
|
|
|
|
|
|
record_from_db = ActiveRecord::Base.connection.execute("select startdate from case_logs where id=#{case_log.id}").to_a[0] |
|
|
|
|
expect(case_log.startdate).to eq(Time.zone.local(2021, 10, 10)) |
|
|
|
|
expect(record_from_db["startdate"]).to eq(Time.zone.local(2021, 10, 10)) |
|
|
|
|
record_from_db = ActiveRecord::Base.connection.execute("select day, month, year, startdate from case_logs where id=#{case_log.id}").to_a[0] |
|
|
|
|
expect(record_from_db["startdate"].day).to eq(10) |
|
|
|
|
expect(record_from_db["startdate"].month).to eq(10) |
|
|
|
|
expect(record_from_db["startdate"].year).to eq(2021) |
|
|
|
|
expect(record_from_db["day"]).to eq(10) |
|
|
|
|
expect(record_from_db["month"]).to eq(10) |
|
|
|
|
expect(record_from_db["year"]).to eq(2021) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|