diff --git a/app/lib/flow/journey.rb b/app/lib/flow/journey.rb
index 7dd93e4aa..c3f319347 100644
--- a/app/lib/flow/journey.rb
+++ b/app/lib/flow/journey.rb
@@ -82,9 +82,9 @@ def populate_file_suffixes
private
- def step_is_completed?(question_page_step)
+ def step_is_completed?(step)
# A step has been completed if it is a question that has been answered.
- question_page_step.question.answered?
+ step.question.answered?
end
def generate_completed_steps
diff --git a/spec/components/check_your_answers_component/view_spec.rb b/spec/components/check_your_answers_component/view_spec.rb
index 5b02d27cc..178232882 100644
--- a/spec/components/check_your_answers_component/view_spec.rb
+++ b/spec/components/check_your_answers_component/view_spec.rb
@@ -8,8 +8,8 @@
let(:optional_question) { build :text, question_text: "Optional question", is_optional: true, text: "" }
let(:steps) do
[
- build(:step, question: question, form_document_step: build(:v2_question_page_step, :with_text_settings)),
- build(:step, question: optional_question, form_document_step: build(:v2_question_page_step, :with_text_settings)),
+ build(:step, question: question, form_document_step: build(:v2_question_step, :with_text_settings)),
+ build(:step, question: optional_question, form_document_step: build(:v2_question_step, :with_text_settings)),
]
end
let(:mode) { Mode.new("form") }
@@ -48,7 +48,7 @@
end
context "when a step is repeatable and has an answer" do
- let(:steps) { [build(:repeatable_step, question: question, form_document_step: build(:v2_question_page_step, :with_text_settings))] }
+ let(:steps) { [build(:repeatable_step, question: question, form_document_step: build(:v2_question_step, :with_text_settings))] }
it "uses the add another answer path for the change link" do
expect(page).to have_link("Change", href: change_add_another_answer_path(mode: mode, form_id: form.id, form_slug: form.form_slug, step_slug: steps[0].id))
diff --git a/spec/components/question/date_component/view_spec.rb b/spec/components/question/date_component/view_spec.rb
index 8214a0324..40960b51c 100644
--- a/spec/components/question/date_component/view_spec.rb
+++ b/spec/components/question/date_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::DateComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, :with_date_settings, input_type: }
+ let(:form_document_step) { build :v2_question_step, :with_date_settings, input_type: }
let(:input_type) { "other_date" }
let(:question_attributes) { { date_day: nil, date_month: nil, date_year: nil } }
let(:question) do
@@ -52,7 +52,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, :with_date_settings, input_type: }
+ let(:form_document_step) { build :v2_question_step, :with_hints, :with_date_settings, input_type: }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -68,7 +68,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, :with_date_settings, input_type:, question_text: "What is your name? " }
+ let(:form_document_step) { build :v2_question_step, :with_date_settings, input_type:, question_text: "What is your name? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -78,7 +78,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_guidance, :with_date_settings }
+ let(:form_document_step) { build :v2_question_step, :with_guidance, :with_date_settings }
it "renders the question text as a legend" do
expect(page.find("legend.govuk-fieldset__legend--m")).to have_text(form_document_step.question_text)
@@ -116,7 +116,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, :with_date_settings, input_type: }
+ let(:form_document_step) { build :v2_question_step, :with_hints, :with_date_settings, input_type: }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -132,7 +132,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, :with_date_settings, input_type:, question_text: "What is your name? " }
+ let(:form_document_step) { build :v2_question_step, :with_date_settings, input_type:, question_text: "What is your name? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -142,7 +142,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_guidance, :with_date_settings }
+ let(:form_document_step) { build :v2_question_step, :with_guidance, :with_date_settings }
it "renders the question text as a legend" do
expect(page.find("legend.govuk-fieldset__legend--m")).to have_text(form_document_step.question_text)
@@ -170,7 +170,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_guidance, answer_type: "date", answer_settings: }
+ let(:form_document_step) { build :v2_question_step, :with_guidance, answer_type: "date", answer_settings: }
it "renders the question text as a legend" do
expect(page.find("legend.govuk-fieldset__legend--m")).to have_text(form_document_step.question_text)
diff --git a/spec/components/question/email_component/view_spec.rb b/spec/components/question/email_component/view_spec.rb
index ebe2f38b4..0988e06ef 100644
--- a/spec/components/question/email_component/view_spec.rb
+++ b/spec/components/question/email_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::EmailComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "email" }
+ let(:form_document_step) { build :v2_question_step, answer_type: "email" }
let(:email) { nil }
let(:question) do
Question::Email.new({ email: email }, {
@@ -44,7 +44,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, answer_type: "email" }
+ let(:form_document_step) { build :v2_question_step, :with_hints, answer_type: "email" }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -60,7 +60,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "email", question_text: "What is your name? " }
+ let(:form_document_step) { build :v2_question_step, answer_type: "email", question_text: "What is your name? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -70,7 +70,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_guidance, answer_type: "email" }
+ let(:form_document_step) { build :v2_question_step, :with_guidance, answer_type: "email" }
it "renders the question text as a label" do
expect(page.find("label.govuk-label--m")).to have_text(form_document_step.question_text)
diff --git a/spec/components/question/file_component/view_spec.rb b/spec/components/question/file_component/view_spec.rb
index 497a43b67..97099cc7c 100644
--- a/spec/components/question/file_component/view_spec.rb
+++ b/spec/components/question/file_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::FileComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "file" }
+ let(:form_document_step) { build :v2_question_step, answer_type: "file" }
let(:question) do
build(:file,
:with_uploaded_file,
@@ -31,7 +31,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, answer_type: "file" }
+ let(:form_document_step) { build :v2_question_step, :with_hints, answer_type: "file" }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -47,7 +47,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "file", question_text: "What is your name? " }
+ let(:form_document_step) { build :v2_question_step, answer_type: "file", question_text: "What is your name? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -57,7 +57,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_guidance, answer_type: "file" }
+ let(:form_document_step) { build :v2_question_step, :with_guidance, answer_type: "file" }
it "renders the question text as a label" do
expect(page.find("label.govuk-label--m")).to have_text(form_document_step.question_text)
diff --git a/spec/components/question/file_remove_component/view_spec.rb b/spec/components/question/file_remove_component/view_spec.rb
index b1605e688..9d6d7366d 100644
--- a/spec/components/question/file_remove_component/view_spec.rb
+++ b/spec/components/question/file_remove_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::FileRemoveComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "file" }
+ let(:form_document_step) { build :v2_question_step, answer_type: "file" }
let(:is_optional) { false }
let(:question_text) { "Upload a file" }
let(:page_heading) { nil }
diff --git a/spec/components/question/file_review_component/view_spec.rb b/spec/components/question/file_review_component/view_spec.rb
index e78410f00..632beb083 100644
--- a/spec/components/question/file_review_component/view_spec.rb
+++ b/spec/components/question/file_review_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::FileReviewComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "file" }
+ let(:form_document_step) { build :v2_question_step, answer_type: "file" }
let(:is_optional) { false }
let(:question_text) { "Upload a file" }
let(:page_heading) { nil }
diff --git a/spec/components/question/national_insurance_number_component/view_spec.rb b/spec/components/question/national_insurance_number_component/view_spec.rb
index ab53fe1b9..53111bc72 100644
--- a/spec/components/question/national_insurance_number_component/view_spec.rb
+++ b/spec/components/question/national_insurance_number_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::NationalInsuranceNumberComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "national_insurance_number" }
+ let(:form_document_step) { build :v2_question_step, answer_type: "national_insurance_number" }
let(:national_insurance_number) { nil }
let(:question) do
Question::NationalInsuranceNumber.new({ national_insurance_number: national_insurance_number }, {
@@ -44,7 +44,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, answer_type: "national_insurance_number" }
+ let(:form_document_step) { build :v2_question_step, :with_hints, answer_type: "national_insurance_number" }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -60,7 +60,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "national_insurance_number", question_text: "What is your name? " }
+ let(:form_document_step) { build :v2_question_step, answer_type: "national_insurance_number", question_text: "What is your name? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -70,7 +70,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_guidance, answer_type: "national_insurance_number" }
+ let(:form_document_step) { build :v2_question_step, :with_guidance, answer_type: "national_insurance_number" }
it "renders the question text as a label" do
expect(page.find("label.govuk-label--m")).to have_text(form_document_step.question_text)
diff --git a/spec/components/question/number_component/view_spec.rb b/spec/components/question/number_component/view_spec.rb
index 2e3b79af3..6f447b6c3 100644
--- a/spec/components/question/number_component/view_spec.rb
+++ b/spec/components/question/number_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::NumberComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "number" }
+ let(:form_document_step) { build :v2_question_step, answer_type: "number" }
let(:number) { nil }
let(:question) do
Question::Number.new({ number: number }, {
@@ -40,7 +40,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, answer_type: "number" }
+ let(:form_document_step) { build :v2_question_step, :with_hints, answer_type: "number" }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -56,7 +56,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "number", question_text: "What is your name? " }
+ let(:form_document_step) { build :v2_question_step, answer_type: "number", question_text: "What is your name? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -66,7 +66,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_guidance, answer_type: "number" }
+ let(:form_document_step) { build :v2_question_step, :with_guidance, answer_type: "number" }
it "renders the question text as a label" do
expect(page.find("label.govuk-label--m")).to have_text(form_document_step.question_text)
diff --git a/spec/components/question/organisation_name_component/view_spec.rb b/spec/components/question/organisation_name_component/view_spec.rb
index b269b092f..306e920f9 100644
--- a/spec/components/question/organisation_name_component/view_spec.rb
+++ b/spec/components/question/organisation_name_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::OrganisationNameComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "organisation_name" }
+ let(:form_document_step) { build :v2_question_step, answer_type: "organisation_name" }
let(:answer_text) { nil }
let(:question) do
Question::OrganisationName.new({ text: answer_text }, {
@@ -44,7 +44,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, answer_type: "organisation_name" }
+ let(:form_document_step) { build :v2_question_step, :with_hints, answer_type: "organisation_name" }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -60,7 +60,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "organisation_name", question_text: "What is your name? " }
+ let(:form_document_step) { build :v2_question_step, answer_type: "organisation_name", question_text: "What is your name? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -70,7 +70,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_guidance, answer_type: "organisation_name" }
+ let(:form_document_step) { build :v2_question_step, :with_guidance, answer_type: "organisation_name" }
it "renders the question text as a label" do
expect(page.find("label.govuk-label--m")).to have_text(form_document_step.question_text)
diff --git a/spec/components/question/phone_number_component/view_spec.rb b/spec/components/question/phone_number_component/view_spec.rb
index b2a825774..1c693f3bd 100644
--- a/spec/components/question/phone_number_component/view_spec.rb
+++ b/spec/components/question/phone_number_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::PhoneNumberComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "phone_number" }
+ let(:form_document_step) { build :v2_question_step, answer_type: "phone_number" }
let(:phone_number) { nil }
let(:question) do
Question::PhoneNumber.new({ phone_number: phone_number }, {
@@ -48,7 +48,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, answer_type: "phone_number" }
+ let(:form_document_step) { build :v2_question_step, :with_hints, answer_type: "phone_number" }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -64,7 +64,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, answer_type: "phone_number", question_text: "What is your phone number? " }
+ let(:form_document_step) { build :v2_question_step, answer_type: "phone_number", question_text: "What is your phone number? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -74,7 +74,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_guidance, answer_type: "phone_number" }
+ let(:form_document_step) { build :v2_question_step, :with_guidance, answer_type: "phone_number" }
it "renders the question text as a label" do
expect(page.find("label.govuk-label--m")).to have_text(form_document_step.question_text)
diff --git a/spec/components/question/text_component/view_spec.rb b/spec/components/question/text_component/view_spec.rb
index 0e24fc817..2bd68a185 100644
--- a/spec/components/question/text_component/view_spec.rb
+++ b/spec/components/question/text_component/view_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe Question::TextComponent::View, type: :component do
- let(:form_document_step) { build :v2_question_page_step, :with_text_settings, input_type: }
+ let(:form_document_step) { build :v2_question_step, :with_text_settings, input_type: }
let(:input_type) { "single_line" }
let(:answer_text) { nil }
let(:question) do
@@ -41,7 +41,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, :with_text_settings, input_type: }
+ let(:form_document_step) { build :v2_question_step, :with_hints, :with_text_settings, input_type: }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -57,7 +57,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, :with_text_settings, input_type:, question_text: "What is your name? " }
+ let(:form_document_step) { build :v2_question_step, :with_text_settings, input_type:, question_text: "What is your name? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -67,7 +67,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_text_settings, :with_guidance, input_type: }
+ let(:form_document_step) { build :v2_question_step, :with_text_settings, :with_guidance, input_type: }
it "renders the question text as a label" do
expect(page.find("label.govuk-label--m")).to have_text(form_document_step.question_text)
@@ -99,7 +99,7 @@
end
context "when the question has hint text" do
- let(:form_document_step) { build :v2_question_page_step, :with_hints, :with_text_settings, input_type: }
+ let(:form_document_step) { build :v2_question_step, :with_hints, :with_text_settings, input_type: }
it "outputs the hint text" do
expect(page.find(".govuk-hint")).to have_text(question.hint_text)
@@ -107,7 +107,7 @@
end
context "with unsafe question text" do
- let(:form_document_step) { build :v2_question_page_step, :with_text_settings, input_type:, question_text: "What is your name? " }
+ let(:form_document_step) { build :v2_question_step, :with_text_settings, input_type:, question_text: "What is your name? " }
let(:mode) { Mode.new("preview-draft") }
it "returns the escaped title with the optional suffix" do
@@ -125,7 +125,7 @@
end
context "when question has guidance" do
- let(:form_document_step) { build :v2_question_page_step, :with_text_settings, :with_guidance, input_type: }
+ let(:form_document_step) { build :v2_question_step, :with_text_settings, :with_guidance, input_type: }
it "renders the question text as a label" do
expect(page.find("label.govuk-label--m")).to have_text(form_document_step.question_text)
diff --git a/spec/factories/models/steps.rb b/spec/factories/models/steps.rb
index f10eeced5..6546dfcec 100644
--- a/spec/factories/models/steps.rb
+++ b/spec/factories/models/steps.rb
@@ -1,6 +1,6 @@
FactoryBot.define do
factory :step, class: "Step" do
- form_document_step { association :v2_question_page_step }
+ form_document_step { association :v2_question_step }
question { build(:full_name_question) }
initialize_with { new(question:, form_document_step:) }
diff --git a/spec/factories/v2_form_document.rb b/spec/factories/v2_form_document.rb
index debd683ab..b66136dad 100644
--- a/spec/factories/v2_form_document.rb
+++ b/spec/factories/v2_form_document.rb
@@ -33,7 +33,7 @@
end
steps do
- Array.new(steps_count) { build(:v2_question_page_step) }
+ Array.new(steps_count) { build(:v2_question_step) }
end
question_section_completed { true }
diff --git a/spec/factories/v2_step.rb b/spec/factories/v2_step.rb
index 73a6d3641..198dbd3a7 100644
--- a/spec/factories/v2_step.rb
+++ b/spec/factories/v2_step.rb
@@ -10,8 +10,8 @@
type { nil }
data { nil }
- factory :v2_question_page_step do
- type { "question_page" }
+ factory :v2_question_step do
+ type { "question" }
transient do
answer_type { "number" }
@@ -50,7 +50,7 @@
guidance_markdown { "## List of items \n\n\n #{Faker::Markdown.ordered_list}" }
end
- factory :v2_selection_question_page_step do
+ factory :v2_selection_question_step do
answer_type { "selection" }
answer_settings do
if none_of_the_above_question
diff --git a/spec/features/email_confirmation_spec.rb b/spec/features/email_confirmation_spec.rb
index dab60958d..105f58b42 100644
--- a/spec/features/email_confirmation_spec.rb
+++ b/spec/features/email_confirmation_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
feature "Email confirmation", type: :feature do
- let(:steps) { [build(:v2_question_page_step, :with_text_settings, id: 1, routing_conditions: [], question_text:)] }
+ let(:steps) { [build(:v2_question_step, :with_text_settings, id: 1, routing_conditions: [], question_text:)] }
let(:form) { build :v2_form_document, :live?, form_id: 1, name: "Apply for a juggling license", steps:, start_page: 1 }
let(:question_text) { Faker::Lorem.question }
let(:text_answer) { Faker::Lorem.sentence }
diff --git a/spec/features/fill_in_and_submit_form_spec.rb b/spec/features/fill_in_and_submit_form_spec.rb
index 07d9254d5..6f6a691e3 100644
--- a/spec/features/fill_in_and_submit_form_spec.rb
+++ b/spec/features/fill_in_and_submit_form_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
feature "Fill in and submit a form", type: :feature do
- let(:steps) { [build(:v2_question_page_step, :with_text_settings, id: 1, routing_conditions: [], question_text:)] }
+ let(:steps) { [build(:v2_question_step, :with_text_settings, id: 1, routing_conditions: [], question_text:)] }
let(:form) { build :v2_form_document, :live?, form_id: 1, name: "Fill in this form", steps:, start_page: 1 }
let(:question_text) { Faker::Lorem.question }
let(:answer_text) { "Answer text" }
diff --git a/spec/features/fill_in_and_submit_form_with_csv_spec.rb b/spec/features/fill_in_and_submit_form_with_csv_spec.rb
index db739a32d..67da3e398 100644
--- a/spec/features/fill_in_and_submit_form_with_csv_spec.rb
+++ b/spec/features/fill_in_and_submit_form_with_csv_spec.rb
@@ -3,8 +3,8 @@
feature "Fill in and submit a form with a CSV submission", type: :feature do
let(:steps) do
[
- build(:v2_selection_question_page_step, id: 1, question_text: "A routing question", routing_conditions: [DataStruct.new(routing_page_id: 1, check_page_id: 1, answer_value: "Option 1", goto_page_id: nil, skip_to_end: true, validation_errors: [])], next_step_id: 2),
- build(:v2_selection_question_page_step, only_one_option: false, id: 2, question_text: "Skipped question", next_step_id: 3),
+ build(:v2_selection_question_step, id: 1, question_text: "A routing question", routing_conditions: [DataStruct.new(routing_page_id: 1, check_page_id: 1, answer_value: "Option 1", goto_page_id: nil, skip_to_end: true, validation_errors: [])], next_step_id: 2),
+ build(:v2_selection_question_step, only_one_option: false, id: 2, question_text: "Skipped question", next_step_id: 3),
]
end
let(:form) { build :v2_form_document, :live?, form_id: 1, name: "Fill in this form", steps:, start_page: steps.first.id, submission_type: "email", submssion_format: %w[csv] }
diff --git a/spec/features/fill_in_autocomplete_question_spec.rb b/spec/features/fill_in_autocomplete_question_spec.rb
index cad8a7f25..4a9bce727 100644
--- a/spec/features/fill_in_autocomplete_question_spec.rb
+++ b/spec/features/fill_in_autocomplete_question_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
feature "Fill in and submit a form with an autocomplete question", type: :feature do
- let(:steps) { [build(:v2_selection_question_page_step, id: 1, routing_conditions: [], question_text:, selection_options:)] }
+ let(:steps) { [build(:v2_selection_question_step, id: 1, routing_conditions: [], question_text:, selection_options:)] }
let(:form) { build :v2_form_document, :live?, form_id: 1, name: "Fill in this form", steps:, start_page: 1 }
let(:selection_options) { Array.new(31).each_with_index.map { |_element, index| { name: "Answer #{index}", value: "Answer #{index}" } } }
let(:question_text) { Faker::Lorem.question }
diff --git a/spec/features/fill_in_file_upload_question_spec.rb b/spec/features/fill_in_file_upload_question_spec.rb
index d5505c5a9..eab23a010 100644
--- a/spec/features/fill_in_file_upload_question_spec.rb
+++ b/spec/features/fill_in_file_upload_question_spec.rb
@@ -3,7 +3,7 @@
feature "Fill in and submit a form with a file upload question", type: :feature do
include ActiveJob::TestHelper
- let(:steps) { [build(:v2_question_page_step, answer_type: "file", id: 1, routing_conditions: [], question_text:)] }
+ let(:steps) { [build(:v2_question_step, answer_type: "file", id: 1, routing_conditions: [], question_text:)] }
let(:form) { build :v2_form_document, :live?, form_id: 1, name: "Fill in this form", steps:, start_page: 1 }
let(:question_text) { Faker::Lorem.question }
let(:answer_text) { "Answer 1" }
diff --git a/spec/features/fill_in_form_with_exit_page_spec.rb b/spec/features/fill_in_form_with_exit_page_spec.rb
index b50fc2930..8302822bb 100644
--- a/spec/features/fill_in_form_with_exit_page_spec.rb
+++ b/spec/features/fill_in_form_with_exit_page_spec.rb
@@ -2,7 +2,7 @@
feature "Fill in and submit a form with an exit page", type: :feature do
let(:routing_conditions) { [DataStruct.new(routing_page_id: 1, check_page_id: 1, answer_value: "Option 1", goto_page_id: nil, exit_page_heading: "This is an exit_page", exit_page_markdown: "This is the contents", validation_errors: [])] }
- let(:steps) { [build(:v2_selection_question_page_step, id: 1, routing_conditions:, question_text:)] }
+ let(:steps) { [build(:v2_selection_question_step, id: 1, routing_conditions:, question_text:)] }
let(:form) { build :v2_form_document, :live?, form_id: 1, name: "Fill in this form", steps:, start_page: 1 }
let(:question_text) { Faker::Lorem.question }
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }
diff --git a/spec/features/fill_in_single_repeatable_form_spec.rb b/spec/features/fill_in_single_repeatable_form_spec.rb
index d5a038a33..f2d8c2c60 100644
--- a/spec/features/fill_in_single_repeatable_form_spec.rb
+++ b/spec/features/fill_in_single_repeatable_form_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
feature "Fill in and submit a form with a single repeatable question", type: :feature do
- let(:steps) { [build(:v2_question_page_step, :with_repeatable, answer_type: "number", question_text:)] }
+ let(:steps) { [build(:v2_question_step, :with_repeatable, answer_type: "number", question_text:)] }
let(:form) { build :v2_form_document, :live?, form_id: 42, name: "Form with repeating question", steps:, start_page: steps.first.id }
let(:question_text) { Faker::Lorem.question }
diff --git a/spec/fixtures/all_question_types_form.json b/spec/fixtures/all_question_types_form.json
index cbccb46e5..ec34a8699 100644
--- a/spec/fixtures/all_question_types_form.json
+++ b/spec/fixtures/all_question_types_form.json
@@ -25,7 +25,7 @@
"id": 1,
"position": 1,
"next_step_id": 2,
- "type": "question_page",
+ "type": "question",
"data": {
"question_text": "Single line of text",
"hint_text": null,
@@ -44,7 +44,7 @@
"id": 2,
"position": 2,
"next_step_id": 3,
- "type": "question_page",
+ "type": "question",
"data": {
"question_text": "Number",
"hint_text": null,
@@ -61,7 +61,7 @@
"id": 3,
"position": 3,
"next_step_id": 4,
- "type": "question_page",
+ "type": "question",
"data": {
"question_text": "Address",
"hint_text": null,
@@ -83,7 +83,7 @@
"id": 4,
"position": 4,
"next_step_id": 5,
- "type": "question_page",
+ "type": "question",
"data": {
"question_text": "Email address",
"hint_text": null,
@@ -100,7 +100,7 @@
"id": 5,
"position": 5,
"next_step_id": 6,
- "type": "question_page",
+ "type": "question",
"data": {
"question_text": "Todays Date",
"hint_text": null,
@@ -119,7 +119,7 @@
"id": 6,
"position": 6,
"next_step_id": 7,
- "type": "question_page",
+ "type": "question",
"data": {
"question_text": "National Insurance number",
"hint_text": null,
@@ -136,7 +136,7 @@
"id": 7,
"position": 7,
"next_step_id": 8,
- "type": "question_page",
+ "type": "question",
"data": {
"question_text": "Phone number",
"hint_text": null,
@@ -153,7 +153,7 @@
"id": 8,
"position": 8,
"next_step_id": 9,
- "type": "question_page",
+ "type": "question",
"data": {
"question_text": "Selection from a list of options",
"hint_text": null,
@@ -183,7 +183,7 @@
"id": 9,
"position": 9,
"next_step_id": null,
- "type": "question_page",
+ "type": "question",
"data": {
"question_text": "Multiple lines of text",
"hint_text": null,
diff --git a/spec/jobs/delete_submissions_job_spec.rb b/spec/jobs/delete_submissions_job_spec.rb
index 53cecfbe4..8d0e28a27 100644
--- a/spec/jobs/delete_submissions_job_spec.rb
+++ b/spec/jobs/delete_submissions_job_spec.rb
@@ -33,11 +33,11 @@
let(:form_without_file_upload) { build :v2_form_document, form_id: 2, steps: [text_step], start_page: text_step.id }
let(:file_upload_steps) do
[
- build(:v2_question_page_step, answer_type: "file", id: 1, next_step_id: 2),
- build(:v2_question_page_step, answer_type: "file", id: 2),
+ build(:v2_question_step, answer_type: "file", id: 1, next_step_id: 2),
+ build(:v2_question_step, answer_type: "file", id: 2),
]
end
- let(:text_step) { build(:v2_question_page_step, :with_text_settings, id: 3) }
+ let(:text_step) { build(:v2_question_step, :with_text_settings, id: 3) }
let(:file_upload_s3_service_spy) { instance_double(Question::FileUploadS3Service) }
diff --git a/spec/lib/csv_generator_spec.rb b/spec/lib/csv_generator_spec.rb
index 411d35ec5..349357eb6 100644
--- a/spec/lib/csv_generator_spec.rb
+++ b/spec/lib/csv_generator_spec.rb
@@ -3,9 +3,9 @@
RSpec.describe CsvGenerator do
let(:form_document) { build(:v2_form_document, form_id: 42, available_languages:, steps: [text_step, name_step, file_upload_step], start_page: text_step.id) }
let(:submission) { create(:submission, form_document:, created_at: timestamp, reference: submission_reference, mode:, submission_locale:, answers:) }
- let(:text_step) { build :v2_question_page_step, :with_text_settings, question_text: "What is the meaning of life?", next_step_id: name_step.id }
- let(:name_step) { build :v2_question_page_step, :with_name_settings, question_text: "What is your name?", next_step_id: file_upload_step.id }
- let(:file_upload_step) { build :v2_question_page_step, :with_file_upload_settings, question_text: "Upload a file" }
+ let(:text_step) { build :v2_question_step, :with_text_settings, question_text: "What is the meaning of life?", next_step_id: name_step.id }
+ let(:name_step) { build :v2_question_step, :with_name_settings, question_text: "What is your name?", next_step_id: file_upload_step.id }
+ let(:file_upload_step) { build :v2_question_step, :with_file_upload_settings, question_text: "Upload a file" }
let(:text_answer) { "blue" }
let(:first_name_answer) { "Alice" }
let(:last_name_answer) { "Smith" }
@@ -59,7 +59,7 @@
end
context "when there are repeated steps" do
- let(:name_step) { build :v2_question_page_step, :with_name_settings, question_text: "What is your name?", next_step_id: file_upload_step.id, is_repeatable: true }
+ let(:name_step) { build :v2_question_step, :with_name_settings, question_text: "What is your name?", next_step_id: file_upload_step.id, is_repeatable: true }
let(:another_first_name_answer) { "John" }
let(:another_last_name_answer) { "Smith" }
let(:answers) do
diff --git a/spec/lib/flow/context_spec.rb b/spec/lib/flow/context_spec.rb
index 5b4a0edf9..d9b18871c 100644
--- a/spec/lib/flow/context_spec.rb
+++ b/spec/lib/flow/context_spec.rb
@@ -8,8 +8,8 @@
let(:steps) do
[
- build(:v2_question_page_step, :with_text_settings, id: 1, next_step_id: 2),
- build(:v2_question_page_step, :with_text_settings, id: 2),
+ build(:v2_question_step, :with_text_settings, id: 1, next_step_id: 2),
+ build(:v2_question_step, :with_text_settings, id: 2),
]
end
diff --git a/spec/lib/flow/journey_spec.rb b/spec/lib/flow/journey_spec.rb
index 04778025c..d3393028b 100644
--- a/spec/lib/flow/journey_spec.rb
+++ b/spec/lib/flow/journey_spec.rb
@@ -20,7 +20,7 @@
end
let(:first_step) do
- build :v2_selection_question_page_step,
+ build :v2_selection_question_step,
id: first_step_id,
next_step_id: second_step_id,
routing_conditions: [DataStruct.new(id: 1, routing_page_id: first_step_id, check_page_id: first_step_id, goto_page_id: third_step_id, answer_value: "Option 1", validation_errors:)]
@@ -29,13 +29,13 @@
let(:validation_errors) { [] }
let(:second_step) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: second_step_id,
next_step_id: third_step_id
end
let(:third_step) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: third_step_id
end
@@ -89,7 +89,7 @@
context "when a question is optional" do
let(:second_step) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
is_optional: true,
id: second_step_id,
next_step_id: third_step_id
@@ -122,7 +122,7 @@
context "when a step is repeatable" do
let(:second_step) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
is_repeatable: true,
id: second_step_id,
next_step_id: third_step_id
@@ -195,13 +195,13 @@
let(:validation_errors) { [{ name: "cannot_have_goto_page_before_routing_page" }] }
let(:first_step) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: first_step_id,
next_step_id: second_step_id
end
let(:second_step) do
- build :v2_selection_question_page_step,
+ build :v2_selection_question_step,
id: second_step_id,
next_step_id: third_step_id,
routing_conditions: [DataStruct.new(id: 1, routing_page_id: second_step_id, check_page_id: second_step_id, goto_page_id: first_step_id, answer_value: "Option 1", validation_errors:)],
@@ -216,10 +216,10 @@
end
context "when there are multiple files with the same name" do
- let(:first_step) { build(:v2_question_page_step, answer_type: "file", id: first_step_id, next_step_id: second_step_id) }
- let(:second_step) { build(:v2_question_page_step, answer_type: "file", id: second_step_id, next_step_id: third_step_id) }
- let(:third_step) { build(:v2_question_page_step, answer_type: "file", id: third_step_id, next_step_id: fourth_step_id) }
- let(:fourth_step) { build(:v2_question_page_step, answer_type: "file", id: fourth_step_id) }
+ let(:first_step) { build(:v2_question_step, answer_type: "file", id: first_step_id, next_step_id: second_step_id) }
+ let(:second_step) { build(:v2_question_step, answer_type: "file", id: second_step_id, next_step_id: third_step_id) }
+ let(:third_step) { build(:v2_question_step, answer_type: "file", id: third_step_id, next_step_id: fourth_step_id) }
+ let(:fourth_step) { build(:v2_question_step, answer_type: "file", id: fourth_step_id) }
let(:form_document_steps) { [first_step, second_step, third_step, fourth_step] }
let(:store) do
{
@@ -247,10 +247,10 @@
end
context "when there are multiple files with different names that are the same after truncation" do
- let(:first_step) { build(:v2_question_page_step, answer_type: "file", id: first_step_id, next_step_id: second_step_id) }
- let(:second_step) { build(:v2_question_page_step, answer_type: "file", id: second_step_id, next_step_id: third_step_id) }
- let(:third_step) { build(:v2_question_page_step, answer_type: "file", id: third_step_id, next_step_id: fourth_step_id) }
- let(:fourth_step) { build(:v2_question_page_step, answer_type: "file", id: fourth_step_id) }
+ let(:first_step) { build(:v2_question_step, answer_type: "file", id: first_step_id, next_step_id: second_step_id) }
+ let(:second_step) { build(:v2_question_step, answer_type: "file", id: second_step_id, next_step_id: third_step_id) }
+ let(:third_step) { build(:v2_question_step, answer_type: "file", id: third_step_id, next_step_id: fourth_step_id) }
+ let(:fourth_step) { build(:v2_question_step, answer_type: "file", id: fourth_step_id) }
let(:form_document_steps) { [first_step, second_step, third_step, fourth_step] }
let(:store) do
{
@@ -324,10 +324,10 @@
end
describe "#completed_file_upload_questions" do
- let(:first_step) { build(:v2_question_page_step, answer_type: "file", id: first_step_id, next_step_id: second_step_id) }
- let(:second_step) { build(:v2_question_page_step, answer_type: "file", id: second_step_id, next_step_id: third_step_id) }
- let(:third_step) { build(:v2_question_page_step, answer_type: "file", id: third_step_id, next_step_id: fourth_step_id) }
- let(:fourth_step) { build(:v2_question_page_step, :with_text_settings, id: fourth_step_id) }
+ let(:first_step) { build(:v2_question_step, answer_type: "file", id: first_step_id, next_step_id: second_step_id) }
+ let(:second_step) { build(:v2_question_step, answer_type: "file", id: second_step_id, next_step_id: third_step_id) }
+ let(:third_step) { build(:v2_question_step, answer_type: "file", id: third_step_id, next_step_id: fourth_step_id) }
+ let(:fourth_step) { build(:v2_question_step, :with_text_settings, id: fourth_step_id) }
let(:form_document_steps) { [first_step, second_step, third_step, fourth_step] }
let(:answer_store) { Store::SessionAnswerStore.new(store, form.id) }
diff --git a/spec/lib/flow/step_factory_spec.rb b/spec/lib/flow/step_factory_spec.rb
index a745b4e42..7c4d6e41d 100644
--- a/spec/lib/flow/step_factory_spec.rb
+++ b/spec/lib/flow/step_factory_spec.rb
@@ -13,7 +13,7 @@
end
context "when creating a regular step" do
- let(:form_document_step) { build_stubbed :v2_question_page_step, id: "page-1", next_step_id: "page-2" }
+ let(:form_document_step) { build_stubbed :v2_question_step, id: "page-1", next_step_id: "page-2" }
let(:question) { instance_double(Question) }
before do
@@ -30,7 +30,7 @@
end
context "when it is the last step" do
- let(:form_document_step) { build :v2_question_page_step, id: "page-1" }
+ let(:form_document_step) { build :v2_question_step, id: "page-1" }
it "sets next_step_slug to CHECK_YOUR_ANSWERS_STEP_SLUG" do
step = factory.create_step("page-1")
@@ -40,7 +40,7 @@
end
context "when creating a repeating step" do
- let(:form_document_step) { build :v2_question_page_step, :with_repeatable, step_slug: "page-1" }
+ let(:form_document_step) { build :v2_question_step, :with_repeatable, step_slug: "page-1" }
let(:question) { instance_double(Question) }
before do
@@ -61,7 +61,7 @@
end
context "when creating the start step" do
- let(:start_page) { build :v2_question_page_step, id: "page-1", next_step_id: "page-2" }
+ let(:start_page) { build :v2_question_step, id: "page-1", next_step_id: "page-2" }
before do
allow(form.form_document_steps).to receive(:find).and_return(start_page)
diff --git a/spec/lib/json_submission_generator_spec.rb b/spec/lib/json_submission_generator_spec.rb
index a0b465e6c..254b55e0a 100644
--- a/spec/lib/json_submission_generator_spec.rb
+++ b/spec/lib/json_submission_generator_spec.rb
@@ -7,11 +7,11 @@
let(:file_question) { build :file, :with_uploaded_file, question_text: "Upload a file", original_filename: "test.txt" }
let(:address_question) { build :uk_address_question, question_text: "What is your address?" }
let(:selection_question) { build :multiple_selection_question, question_text: "Select your options" }
- let(:text_step) { build :step, form_document_step: build(:v2_question_page_step, :with_text_settings), question: text_question }
- let(:name_step) { build :step, form_document_step: build(:v2_question_page_step, answer_type: "name"), question: name_question }
- let(:file_step) { build :step, form_document_step: build(:v2_question_page_step, answer_type: "file"), question: file_question }
- let(:address_step) { build :step, form_document_step: build(:v2_question_page_step, :with_address_settings), question: address_question }
- let(:selection_step) { build :step, form_document_step: build(:v2_selection_question_page_step), question: selection_question }
+ let(:text_step) { build :step, form_document_step: build(:v2_question_step, :with_text_settings), question: text_question }
+ let(:name_step) { build :step, form_document_step: build(:v2_question_step, answer_type: "name"), question: name_question }
+ let(:file_step) { build :step, form_document_step: build(:v2_question_step, answer_type: "file"), question: file_question }
+ let(:address_step) { build :step, form_document_step: build(:v2_question_step, :with_address_settings), question: address_question }
+ let(:selection_step) { build :step, form_document_step: build(:v2_selection_question_step), question: selection_question }
let(:all_steps) { [text_step, name_step, file_step, address_step, selection_step] }
let(:submission_reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }
let(:language) { nil }
@@ -101,7 +101,7 @@
context "when there is a repeatable question" do
let(:question_text) { "What is the meaning of life?" }
- let(:form_document_step) { build(:v2_question_page_step, :with_text_settings, :with_repeatable, question_text:) }
+ let(:form_document_step) { build(:v2_question_step, :with_text_settings, :with_repeatable, question_text:) }
let(:first_answer) { build :text, question_text:, text: "dunno" }
let(:second_answer) { build :text, question_text:, text: "42" }
let(:repeatable_step) { build :repeatable_step, form_document_step:, questions: [first_answer, second_answer] }
diff --git a/spec/lib/tasks/submissions.rake_spec.rb b/spec/lib/tasks/submissions.rake_spec.rb
index eaf52b142..540f1a980 100644
--- a/spec/lib/tasks/submissions.rake_spec.rb
+++ b/spec/lib/tasks/submissions.rake_spec.rb
@@ -746,7 +746,7 @@
:v2_form_document,
steps: [
build(
- :v2_question_page_step,
+ :v2_question_step,
id: "aB123z",
answer_type: "file",
question_text: "Upload your evidence",
@@ -814,7 +814,7 @@
:v2_form_document,
steps: [
build(
- :v2_question_page_step,
+ :v2_question_step,
id: "a",
answer_type: "file",
question_text: "Upload your evidence",
@@ -853,28 +853,28 @@
:v2_form_document,
steps: [
build(
- :v2_question_page_step,
+ :v2_question_step,
id: "i",
answer_type: "file",
question_text: "Upload your evidence 1",
position: "1",
),
build(
- :v2_question_page_step,
+ :v2_question_step,
id: "j",
answer_type: "file",
question_text: "Upload your evidence 2",
position: "2",
),
build(
- :v2_question_page_step,
+ :v2_question_step,
id: "k",
answer_type: "file",
question_text: "Upload your evidence 2",
position: "3",
),
build(
- :v2_question_page_step,
+ :v2_question_step,
id: "l",
answer_type: "file",
question_text: "Upload your evidence 4",
diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb
index e8e6294a7..ccc684528 100644
--- a/spec/models/form_spec.rb
+++ b/spec/models/form_spec.rb
@@ -42,8 +42,8 @@
let(:form_document) { build :v2_form_document, steps: }
let(:steps) do
[
- build(:v2_question_page_step, id: 9, next_step_id: 10, answer_type: "date", question_text: "Question one"),
- build(:v2_question_page_step, id: 10, answer_type: "address", question_text: "Question two"),
+ build(:v2_question_step, id: 9, next_step_id: 10, answer_type: "date", question_text: "Question one"),
+ build(:v2_question_step, id: 10, answer_type: "address", question_text: "Question two"),
]
end
diff --git a/spec/models/repeatable_step_spec.rb b/spec/models/repeatable_step_spec.rb
index d617216db..faca79438 100644
--- a/spec/models/repeatable_step_spec.rb
+++ b/spec/models/repeatable_step_spec.rb
@@ -3,8 +3,8 @@
RSpec.describe RepeatableStep, type: :model do
subject(:repeatable_step) { described_class.new(question:, form_document_step:) }
- let(:form) { build :form, id: 1, form_slug: "form-slug", steps: [form_document_step, build(:v2_question_page_step, id: 2)] }
- let(:form_document_step) { build :v2_question_page_step }
+ let(:form) { build :form, id: 1, form_slug: "form-slug", steps: [form_document_step, build(:v2_question_step, id: 2)] }
+ let(:form_document_step) { build :v2_question_step }
let(:question) { build :name, is_optional: false }
let(:submission_reference) { "abc123" }
@@ -236,7 +236,7 @@
describe "#show_answer_in_json" do
context "when the step has multiple answers" do
- let(:form_document_step) { build(:v2_question_page_step, :with_name_settings, id: 2) }
+ let(:form_document_step) { build(:v2_question_step, :with_name_settings, id: 2) }
let(:questions) { [first_question, second_question] }
let(:first_question) { build :first_and_last_name_question, question_text: form_document_step.question_text }
let(:second_question) { build :first_and_last_name_question, question_text: form_document_step.question_text }
@@ -269,7 +269,7 @@
end
context "when the question is optional and has no answers" do
- let(:form_document_step) { build(:v2_question_page_step, :with_name_settings, id: 2) }
+ let(:form_document_step) { build(:v2_question_step, :with_name_settings, id: 2) }
let(:question) { build :first_and_last_name_question, :unanswered, question_text: form_document_step.question_text }
it "returns a hash with an array containing a blank answer" do
diff --git a/spec/models/step_spec.rb b/spec/models/step_spec.rb
index c41adafab..bbad0f24b 100644
--- a/spec/models/step_spec.rb
+++ b/spec/models/step_spec.rb
@@ -15,7 +15,7 @@
let(:fourth_step_id) { step_ids[3] }
let(:question) { instance_double(Question::Text, serializable_hash: {}, attribute_names: %w[name], valid?: true, errors: []) }
- let(:form_document_step) { build(:v2_question_page_step, id: first_step_id, position: 1, next_step_id: second_step_id, routing_conditions: []) }
+ let(:form_document_step) { build(:v2_question_step, id: first_step_id, position: 1, next_step_id: second_step_id, routing_conditions: []) }
let(:answer_store) { instance_double(Store::SessionAnswerStore) }
describe "#initialize" do
@@ -40,7 +40,7 @@
it "returns false for steps with different states" do
other_step = described_class.new(
question:,
- form_document_step: build(:v2_question_page_step),
+ form_document_step: build(:v2_question_step),
)
expect(step == other_step).to be false
end
@@ -131,7 +131,7 @@
let(:selection) { "Yes" }
let(:question) { instance_double(Question::Selection, selection:) }
let(:routing_conditions) { [] }
- let(:form_document_step) { build(:v2_question_page_step, id: first_step_id, position: 1, next_step_id: default_next_step_id, routing_conditions:) }
+ let(:form_document_step) { build(:v2_question_step, id: first_step_id, position: 1, next_step_id: default_next_step_id, routing_conditions:) }
describe "basic routing" do
context "without any routing conditions" do
@@ -354,7 +354,7 @@
describe "#show_answer_in_json" do
let(:question) { build :first_and_last_name_question }
- let(:form_document_step) { build(:v2_question_page_step, :with_name_settings, id: first_step_id) }
+ let(:form_document_step) { build(:v2_question_step, :with_name_settings, id: first_step_id) }
let(:is_s3_submission) { false }
let(:submission_reference) { "abc123" }
@@ -385,7 +385,7 @@
context "when there are no routing conditions" do
let(:routing_conditions) { [] }
- let(:form_document_step) { build(:v2_question_page_step, position: 1, routing_conditions: routing_conditions) }
+ let(:form_document_step) { build(:v2_question_step, position: 1, routing_conditions: routing_conditions) }
it "returns an empty array" do
expect(step.conditions_with_goto_errors).to be_empty
@@ -395,7 +395,7 @@
context "when routing conditions have no errors" do
let(:condition) { OpenStruct.new(validation_errors: []) }
let(:routing_conditions) { [condition] }
- let(:form_document_step) { build(:v2_question_page_step, position: 1, routing_conditions: routing_conditions) }
+ let(:form_document_step) { build(:v2_question_step, position: 1, routing_conditions: routing_conditions) }
it "returns an empty array" do
expect(step.conditions_with_goto_errors).to be_empty
@@ -406,7 +406,7 @@
let(:condition) { OpenStruct.new(validation_errors: [cannot_have_goto_page_before_routing_page_error]) }
let(:second_condition) { OpenStruct.new(validation_errors: [goto_page_doesnt_exist_error]) }
let(:routing_conditions) { [condition, second_condition] }
- let(:form_document_step) { build(:v2_question_page_step, position: 1, routing_conditions: routing_conditions) }
+ let(:form_document_step) { build(:v2_question_step, position: 1, routing_conditions: routing_conditions) }
it "returns conditions with specified errors" do
expect(step.conditions_with_goto_errors).to contain_exactly(condition, second_condition)
@@ -416,7 +416,7 @@
context "when routing conditions have irrelevant errors" do
let(:condition) { OpenStruct.new(validation_errors: [other_error]) }
let(:routing_conditions) { [condition] }
- let(:form_document_step) { build(:v2_question_page_step, position: 1, routing_conditions: routing_conditions) }
+ let(:form_document_step) { build(:v2_question_step, position: 1, routing_conditions: routing_conditions) }
it "returns an empty array" do
expect(step.conditions_with_goto_errors).to be_empty
@@ -428,7 +428,7 @@
let(:condition_other) { OpenStruct.new(validation_errors: [other_error]) }
let(:condition_goto) { OpenStruct.new(validation_errors: [goto_page_doesnt_exist_error]) }
let(:routing_conditions) { [condition_mixed, condition_other, condition_goto] }
- let(:form_document_step) { build(:v2_question_page_step, position: 1, routing_conditions: routing_conditions) }
+ let(:form_document_step) { build(:v2_question_step, position: 1, routing_conditions: routing_conditions) }
it "returns only conditions with specified errors" do
expect(step.conditions_with_goto_errors).to contain_exactly(condition_mixed, condition_goto)
@@ -461,7 +461,7 @@
let(:selection) { "Yes" }
let(:question) { instance_double(Question::Selection, selection:) }
let(:routing_conditions) { [OpenStruct.new(answer_value: "Yes", exit_page_markdown: "string")] }
- let(:form_document_step) { build(:v2_question_page_step, position: 1, routing_conditions:) }
+ let(:form_document_step) { build(:v2_question_step, position: 1, routing_conditions:) }
it "returns true when condition matches and condition is an exit page" do
expect(step.exit_page_condition_matches?).to be true
diff --git a/spec/requests/errors_controller_spec.rb b/spec/requests/errors_controller_spec.rb
index 1081502d5..1f6d7b771 100644
--- a/spec/requests/errors_controller_spec.rb
+++ b/spec/requests/errors_controller_spec.rb
@@ -45,7 +45,7 @@
submission_email: "submission@email.com",
start_page: 1,
steps: [
- build(:v2_question_page_step, id: 1, answer_type: "text", answer_settings: { input_type: "single_line" }),
+ build(:v2_question_step, id: 1, answer_type: "text", answer_settings: { input_type: "single_line" }),
],
)
end
diff --git a/spec/requests/forms/add_another_answer_controller_spec.rb b/spec/requests/forms/add_another_answer_controller_spec.rb
index 381f891b1..31b984a4a 100644
--- a/spec/requests/forms/add_another_answer_controller_spec.rb
+++ b/spec/requests/forms/add_another_answer_controller_spec.rb
@@ -8,7 +8,7 @@
let(:steps) { [first_step_in_form, second_step_in_form] }
let(:first_step_in_form) do
- build :v2_question_page_step,
+ build :v2_question_step,
:with_text_settings,
id: 1,
next_step_id: 2,
@@ -17,7 +17,7 @@
end
let(:second_step_in_form) do
- build :v2_question_page_step, :with_text_settings, id: 2
+ build :v2_question_step, :with_text_settings, id: 2
end
let(:req_headers) { { "Accept" => "application/json" } }
diff --git a/spec/requests/forms/base_controller_spec.rb b/spec/requests/forms/base_controller_spec.rb
index 1368d83e6..aedc4bfab 100644
--- a/spec/requests/forms/base_controller_spec.rb
+++ b/spec/requests/forms/base_controller_spec.rb
@@ -27,13 +27,13 @@
let(:steps_data) do
[
- (attributes_for :v2_question_page_step,
+ (attributes_for :v2_question_step,
id: 1,
next_page: 2,
answer_type: "text",
answer_settings: { input_type: "single_line" }
),
- (attributes_for :v2_question_page_step,
+ (attributes_for :v2_question_step,
id: 2,
answer_type: "text",
answer_settings: { input_type: "single_line" }
diff --git a/spec/requests/forms/check_your_answers_controller_spec.rb b/spec/requests/forms/check_your_answers_controller_spec.rb
index b8a4d3edc..29da5a643 100644
--- a/spec/requests/forms/check_your_answers_controller_spec.rb
+++ b/spec/requests/forms/check_your_answers_controller_spec.rb
@@ -50,18 +50,18 @@
let(:steps_data) do
[
- build(:v2_question_page_step,
+ build(:v2_question_step,
id: 1,
position: 1,
next_step_id: 2,
- type: "question_page",
+ type: "question",
answer_type: "date",
is_optional: nil,
question_text: "Question one"),
- build(:v2_question_page_step,
+ build(:v2_question_step,
id: 2,
position: 2,
- type: "question_page",
+ type: "question",
answer_type: "date",
is_optional: nil,
question_text: "Question two"),
diff --git a/spec/requests/forms/copy_of_answers_controller_spec.rb b/spec/requests/forms/copy_of_answers_controller_spec.rb
index 2790a8f57..bd9082c46 100644
--- a/spec/requests/forms/copy_of_answers_controller_spec.rb
+++ b/spec/requests/forms/copy_of_answers_controller_spec.rb
@@ -7,8 +7,8 @@
let(:steps) do
[
- build(:v2_question_page_step, :with_text_settings, id: 1, next_step_id: 2),
- build(:v2_question_page_step, :with_text_settings, id: 2),
+ build(:v2_question_step, :with_text_settings, id: 1, next_step_id: 2),
+ build(:v2_question_step, :with_text_settings, id: 2),
]
end
diff --git a/spec/requests/forms/privacy_page_controller_spec.rb b/spec/requests/forms/privacy_page_controller_spec.rb
index 2150c7409..3c2691a01 100644
--- a/spec/requests/forms/privacy_page_controller_spec.rb
+++ b/spec/requests/forms/privacy_page_controller_spec.rb
@@ -13,18 +13,18 @@
let(:steps_data) do
[
- build(:v2_question_page_step,
+ build(:v2_question_step,
id: 1,
position: 1,
next_step_id: 2,
- type: "question_page",
+ type: "question",
answer_type: "date",
is_optional: nil,
question_text: "Question one"),
- build(:v2_question_page_step,
+ build(:v2_question_step,
id: 2,
position: 2,
- type: "question_page",
+ type: "question",
answer_type: "date",
is_optional: nil,
question_text: "Question two"),
diff --git a/spec/requests/forms/remove_answer_controller_spec.rb b/spec/requests/forms/remove_answer_controller_spec.rb
index f72629ebf..5548211d5 100644
--- a/spec/requests/forms/remove_answer_controller_spec.rb
+++ b/spec/requests/forms/remove_answer_controller_spec.rb
@@ -10,7 +10,7 @@
let(:remove) { "yes" }
let(:first_step_in_form) do
- build :v2_question_page_step,
+ build :v2_question_step,
:with_text_settings,
:with_repeatable,
id: 1,
@@ -19,7 +19,7 @@
end
let(:second_step_in_form) do
- build :v2_question_page_step, :with_text_settings, id: 2
+ build :v2_question_step, :with_text_settings, id: 2
end
let(:req_headers) { { "Accept" => "application/json" } }
diff --git a/spec/requests/forms/remove_file_controller_spec.rb b/spec/requests/forms/remove_file_controller_spec.rb
index b893450e1..6f82dd31d 100644
--- a/spec/requests/forms/remove_file_controller_spec.rb
+++ b/spec/requests/forms/remove_file_controller_spec.rb
@@ -12,14 +12,14 @@
end
let(:file_upload_step) do
- build :v2_question_page_step,
+ build :v2_question_step,
id: 1,
next_step_id: 2,
answer_type: "file"
end
let(:text_question_step) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: 2
end
diff --git a/spec/requests/forms/review_file_controller_spec.rb b/spec/requests/forms/review_file_controller_spec.rb
index 9d3c276cf..14be7ac07 100644
--- a/spec/requests/forms/review_file_controller_spec.rb
+++ b/spec/requests/forms/review_file_controller_spec.rb
@@ -12,14 +12,14 @@
end
let(:file_upload_step) do
- build :v2_question_page_step,
+ build :v2_question_step,
id: 1,
next_step_id: 2,
answer_type: "file"
end
let(:text_question_step) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: 2
end
diff --git a/spec/requests/forms/selection_none_of_the_above_controller_spec.rb b/spec/requests/forms/selection_none_of_the_above_controller_spec.rb
index 9bf0aab59..1cd1e0f5d 100644
--- a/spec/requests/forms/selection_none_of_the_above_controller_spec.rb
+++ b/spec/requests/forms/selection_none_of_the_above_controller_spec.rb
@@ -7,20 +7,20 @@
let(:step_slug) { selection_question_step.id }
let(:text_question_step) do
- build :v2_question_page_step, :with_text_settings, id: 1, next_step_id: selection_question_step.id
+ build :v2_question_step, :with_text_settings, id: 1, next_step_id: selection_question_step.id
end
let(:selection_options) { Array.new(31).map { |i| { name: "Option #{i}", value: "Option #{i}" } } }
let(:none_of_the_above_question_text) { "Give another answer" }
let(:selection_question_step) do
- build(:v2_selection_question_page_step,
+ build(:v2_selection_question_step,
:with_none_of_the_above_question,
id: 2,
next_step_id: final_step.id,
selection_options:,
none_of_the_above_question_text:)
end
- let(:final_step) { build(:v2_question_page_step, id: 3) }
+ let(:final_step) { build(:v2_question_step, id: 3) }
let(:steps_data) { [text_question_step, selection_question_step, final_step] }
@@ -83,7 +83,7 @@
context "when the step is a selection question" do
context "when the selection question does not have a none of the above question" do
let(:selection_question_step) do
- build(:v2_selection_question_page_step,
+ build(:v2_selection_question_step,
selection_options:,
id: 2,
next_step_id: final_step.id)
diff --git a/spec/requests/forms/step_controller_spec.rb b/spec/requests/forms/step_controller_spec.rb
index 96fe9d709..be0c32e63 100644
--- a/spec/requests/forms/step_controller_spec.rb
+++ b/spec/requests/forms/step_controller_spec.rb
@@ -17,20 +17,20 @@
let(:first_step_id) { 1 }
let(:first_step_in_form) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: first_step_id,
next_step_id: 2,
is_optional: false
end
let(:second_step_in_form) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: 2,
is_optional:
end
let(:page_with_routing) do
- build :v2_selection_question_page_step,
+ build :v2_selection_question_step,
id: first_step_id,
next_step_id: 2,
routing_conditions: [DataStruct.new(id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3, answer_value: "Option 1", validation_errors:)],
@@ -64,7 +64,7 @@
start_page: step_id,
declaration_text: "agree to the declaration",
steps: [
- build(:v2_question_page_step, :with_text_settings,
+ build(:v2_question_step, :with_text_settings,
id: step_id,
position: 1,
is_optional: false),
@@ -268,7 +268,7 @@
let(:mode) { "preview-live" }
let(:first_step_in_form) do
- step_without_routing_conditions = attributes_for(:v2_question_page_step, :with_text_settings,
+ step_without_routing_conditions = attributes_for(:v2_question_step, :with_text_settings,
id: 1,
next_step_id: 2,
is_optional: false).except(:routing_conditions)
@@ -290,14 +290,14 @@
let(:validation_errors) { [] }
let(:second_step_in_form) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: 2,
next_step_id: 3,
is_optional:
end
let(:third_step_in_form) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: 3,
is_optional:
end
@@ -330,7 +330,7 @@
context "when the route is a secondary skip" do
let(:page_with_secondary_skip) do
- build :v2_selection_question_page_step,
+ build :v2_selection_question_step,
id: 4,
next_step_id: nil,
skip_to_end: true,
@@ -380,7 +380,7 @@
context "when page is repeatable" do
let(:mode) { "form" }
- let(:first_step_in_form) { build :v2_question_page_step, :with_repeatable, id: 1, next_step_id: second_step_in_form.id }
+ let(:first_step_in_form) { build :v2_question_step, :with_repeatable, id: 1, next_step_id: second_step_in_form.id }
it "shows the page as normal when there are no stored answers" do
get form_step_path(mode:, form_id: form_data.form_id, form_slug: form_data.form_slug, step_slug: first_step_in_form.id, answer_index: 1)
@@ -395,7 +395,7 @@
context "when the page is a file upload question" do
let(:first_step_in_form) do
- build :v2_question_page_step,
+ build :v2_question_step,
id: 1,
next_step_id: 2,
answer_type: "file",
@@ -503,7 +503,7 @@
let(:mode) { "preview-live" }
let(:first_step_in_form) do
- step_without_routing_conditions = attributes_for(:v2_question_page_step, :with_text_settings,
+ step_without_routing_conditions = attributes_for(:v2_question_step, :with_text_settings,
id: 1,
next_step_id: 2,
is_optional: false).except(:routing_conditions)
@@ -525,14 +525,14 @@
let(:validation_errors) { [] }
let(:second_step_in_form) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: 2,
next_step_id: 3,
is_optional:
end
let(:third_step_in_form) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: 3,
is_optional:
end
@@ -565,7 +565,7 @@
context "when the route is a secondary skip" do
let(:page_with_secondary_skip) do
- build :v2_selection_question_page_step,
+ build :v2_selection_question_step,
id: 4,
next_step_id: nil,
skip_to_end: true,
@@ -615,7 +615,7 @@
context "when page is repeatable" do
let(:mode) { "form" }
- let(:first_step_in_form) { build :v2_question_page_step, :with_repeatable, id: 1, next_step_id: second_step_in_form.id }
+ let(:first_step_in_form) { build :v2_question_step, :with_repeatable, id: 1, next_step_id: second_step_in_form.id }
it "shows the page as normal when there are no stored answers" do
get form_step_path(mode:, form_id: form_data.form_id, form_slug: form_data.form_slug, step_slug: first_step_in_form.id, answer_index: 1)
@@ -630,7 +630,7 @@
context "when the page is a file upload question" do
let(:first_step_in_form) do
- build :v2_question_page_step,
+ build :v2_question_step,
id: 1,
next_step_id: 2,
answer_type: "file",
@@ -825,14 +825,14 @@
let(:validation_errors) { [] }
let(:second_step_in_form) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: 2,
next_step_id: 3,
is_optional:
end
let(:third_step_in_form) do
- build :v2_question_page_step, :with_text_settings,
+ build :v2_question_step, :with_text_settings,
id: 3,
is_optional:
end
@@ -875,7 +875,7 @@
end
context "when page is repeatable" do
- let(:first_step_in_form) { build :v2_question_page_step, :with_repeatable, id: 1, next_step_id: second_step_in_form.id }
+ let(:first_step_in_form) { build :v2_question_step, :with_repeatable, id: 1, next_step_id: second_step_in_form.id }
it "redirects to the add another answer page when given valid answer" do
post save_form_step_path(mode:, form_id: form_data.form_id, form_slug: form_data.form_slug, step_slug: first_step_in_form.id, params: { question: { number: 12 } })
@@ -888,7 +888,7 @@
end
context "and is optional" do
- let(:first_step_in_form) { build :v2_question_page_step, :with_repeatable, is_optional: true, id: 1, next_step_id: second_step_in_form.id }
+ let(:first_step_in_form) { build :v2_question_step, :with_repeatable, is_optional: true, id: 1, next_step_id: second_step_in_form.id }
it "redirects to the next page when not given an answer" do
post save_form_step_path(mode:, form_id: form_data.form_id, form_slug: form_data.form_slug, step_slug: first_step_in_form.id, params: { question: { number: nil } })
@@ -899,7 +899,7 @@
context "when the page is a file upload question" do
let(:first_step_in_form) do
- build :v2_question_page_step,
+ build :v2_question_step,
id: 1,
next_step_id: 2,
answer_type: "file",
@@ -986,7 +986,7 @@
context "when the page is a selection question with a none of the above question" do
let(:first_step_in_form) do
- build(:v2_selection_question_page_step,
+ build(:v2_selection_question_step,
:with_none_of_the_above_question,
id: 1,
next_step_id: 2,
@@ -1047,7 +1047,7 @@
context "when the page is a an exit question" do
let(:first_step_in_form) do
- build :v2_selection_question_page_step,
+ build :v2_selection_question_step,
id: 1,
next_step_id: 2,
routing_conditions: [DataStruct.new(id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: nil, answer_value: "Option 1", validation_errors: [], exit_page_markdown: "Exit page markdown", exit_page_heading: "exit page heading")],
diff --git a/spec/requests/forms/submitted_controller_spec.rb b/spec/requests/forms/submitted_controller_spec.rb
index af8c17b67..fc353a826 100644
--- a/spec/requests/forms/submitted_controller_spec.rb
+++ b/spec/requests/forms/submitted_controller_spec.rb
@@ -13,14 +13,14 @@
let(:steps_data) do
[
- build(:v2_question_page_step,
+ build(:v2_question_step,
id: 1,
position: 1,
question_text: "Question one",
answer_type: "date",
next_step_id: 2,
is_optional: nil),
- build(:v2_question_page_step,
+ build(:v2_question_step,
id: 2,
position: 2,
question_text: "Question two",
diff --git a/spec/services/form_submission_service_spec.rb b/spec/services/form_submission_service_spec.rb
index 5e69878d1..6349913a5 100644
--- a/spec/services/form_submission_service_spec.rb
+++ b/spec/services/form_submission_service_spec.rb
@@ -32,7 +32,7 @@
let(:welsh_document_json) { document_json.merge("language" => "cy", "name" => "Welsh Form 1") }
- let(:steps) { [build(:v2_question_page_step, id: 2, answer_type: "text")] }
+ let(:steps) { [build(:v2_question_step, id: 2, answer_type: "text")] }
let(:submission_type) { "email" }
let(:submission_format) { [] }
let(:what_happens_next_markdown) { "We usually respond to applications within 10 working days." }
diff --git a/spec/views/forms/check_your_answers/show.html.erb_spec.rb b/spec/views/forms/check_your_answers/show.html.erb_spec.rb
index 7dc93a1ec..5c15d0503 100644
--- a/spec/views/forms/check_your_answers/show.html.erb_spec.rb
+++ b/spec/views/forms/check_your_answers/show.html.erb_spec.rb
@@ -9,7 +9,7 @@
let(:declaration_markdown) { nil }
let(:email_confirmation_input) { build :email_confirmation_input }
let(:question) { build :text, question_text: "Do you want to remain anonymous?", text: "Yes" }
- let(:steps) { [build(:step, question:, form_document_step: build(:v2_question_page_step, :with_text_settings))] }
+ let(:steps) { [build(:step, question:, form_document_step: build(:v2_question_step, :with_text_settings))] }
before do
assign(:current_context, context)