From 627d5fd9abf0da0645f4cbfd38f5a4f22f63d474 Mon Sep 17 00:00:00 2001 From: Kat Date: Wed, 7 Sep 2022 11:35:02 +0100 Subject: [PATCH] Fix salse form end date and the test --- app/models/form.rb | 2 +- spec/models/form_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/form.rb b/app/models/form.rb index 0af94b403..2229ca67f 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -16,7 +16,7 @@ class Form @pages = subsections.flat_map(&:pages) @questions = pages.flat_map(&:questions) @start_date = Time.zone.local(name[0..3], 4, 1) - @end_date = Time.zone.local(start_date.year + 1, 4, 1) + @end_date = Time.zone.local(start_date.year + 1, 7, 1) @form_definition = { "form_type" => type, "start_date" => start_date, diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb index 13a97ae58..b779213c4 100644 --- a/spec/models/form_spec.rb +++ b/spec/models/form_spec.rb @@ -212,10 +212,10 @@ RSpec.describe Form, type: :model do form = described_class.new(nil, "2022_23_sales", sections, "sales") expect(form.type).to eq("sales") expect(form.name).to eq("2022_23_sales") - expect(form.form_sections.count).to eq(1) - expect(form.form_sections[0].class).to eq(sections[0]) + expect(form.setup_sections.count).to eq(1) + expect(form.setup_sections[0].class).to eq(Form::Sales::Setup::Sections::Setup) expect(form.sections.count).to eq(1) - expect(form.sections[0].class).to eq(sections[0]) + expect(form.sections[0].class).to eq(Form::Sales::Setup::Sections::Setup) expect(form.subsections.count).to eq(1) expect(form.subsections.first.id).to eq("setup") expect(form.pages.count).to eq(1) @@ -223,7 +223,7 @@ RSpec.describe Form, type: :model do expect(form.questions.count).to eq(1) expect(form.questions.first.id).to eq("saledate") expect(form.start_date).to eq(Time.zone.parse("2022-04-01")) - expect(form.end_date).to eq(Time.zone.parse("2023-04-01")) + expect(form.end_date).to eq(Time.zone.parse("2023-07-01")) end end end