diff --git a/.erb-lint.yml b/.erb-lint.yml
new file mode 100644
index 000000000..2d88a7447
--- /dev/null
+++ b/.erb-lint.yml
@@ -0,0 +1,24 @@
+---
+EnableDefaultLinters: true
+linters:
+ Rubocop:
+ enabled: true
+ rubocop_config:
+ inherit_from:
+ - .rubocop.yml
+ Layout/ArgumentAlignment:
+ Enabled: false
+ Layout/CommentIndentation:
+ Enabled: false
+ Layout/FirstArgumentIndentation:
+ Enabled: false
+ Layout/FirstArrayElementIndentation:
+ Enabled: false
+ Layout/FirstHashElementIndentation:
+ Enabled: false
+ Layout/InitialIndentation:
+ Enabled: false
+ Layout/TrailingEmptyLines:
+ Enabled: false
+ Lint/UselessAssignment:
+ Enabled: false
diff --git a/Gemfile b/Gemfile
index 09562e673..9fc19e4d0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -78,6 +78,7 @@ group :development do
gem "web-console", ">= 4.1.0"
# Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
+ gem "erb_lint", require: false
gem "rack-mini-profiler", "~> 2.0"
gem "rubocop-govuk", require: false
gem "rubocop-performance", require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 62d70821c..098243ed8 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -69,7 +69,7 @@ GEM
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
- activeadmin (2.11.1)
+ activeadmin (2.11.2)
arbre (~> 1.2, >= 1.2.1)
formtastic (>= 3.1, < 5.0)
formtastic_i18n (~> 0.4)
@@ -105,8 +105,8 @@ GEM
ruby2_keywords (>= 0.0.2, < 1.0)
ast (2.4.2)
aws-eventstream (1.2.0)
- aws-partitions (1.575.0)
- aws-sdk-core (3.130.0)
+ aws-partitions (1.576.0)
+ aws-sdk-core (3.130.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
@@ -121,6 +121,14 @@ GEM
aws-sigv4 (1.4.0)
aws-eventstream (~> 1, >= 1.0.2)
bcrypt (3.1.17)
+ better_html (1.0.16)
+ actionview (>= 4.0)
+ activesupport (>= 4.0)
+ ast (~> 2.0)
+ erubi (~> 1.4)
+ html_tokenizer (~> 0.0.6)
+ parser (>= 2.4)
+ smart_properties
bindex (0.8.1)
bootsnap (1.11.1)
msgpack (~> 1.2)
@@ -159,6 +167,14 @@ GEM
dotenv (= 2.7.6)
railties (>= 3.2)
encryptor (3.0.0)
+ erb_lint (0.1.1)
+ activesupport
+ better_html (~> 1.0.7)
+ html_tokenizer
+ parser (>= 2.7.1.4)
+ rainbow
+ rubocop
+ smart_properties
erubi (1.10.0)
excon (0.92.2)
factory_bot (6.2.1)
@@ -188,6 +204,7 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
hashdiff (1.0.1)
+ html_tokenizer (0.0.7)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
inherited_resources (1.13.1)
@@ -269,7 +286,7 @@ GEM
globalid
paper_trail (>= 3.0.0)
parallel (1.22.1)
- parser (3.1.1.0)
+ parser (3.1.2.0)
ast (~> 2.4.1)
pg (1.3.5)
postcodes_io (0.4.0)
@@ -420,6 +437,7 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
+ smart_properties (1.17.0)
stimulus-rails (1.0.4)
railties (>= 6.0.0)
strscan (3.0.1)
@@ -469,6 +487,7 @@ DEPENDENCIES
chartkick
devise!
dotenv-rails
+ erb_lint
factory_bot_rails
govuk-components
govuk_design_system_formbuilder
diff --git a/app/components/document_list_component.html.erb b/app/components/document_list_component.html.erb
new file mode 100644
index 000000000..6242ab3dc
--- /dev/null
+++ b/app/components/document_list_component.html.erb
@@ -0,0 +1,15 @@
+
-
-
-
-
- <%= form_with url: "/logs", html: { method: :get } do |f| %>
- <% years = {"2021": "2021/22", "2022": "2022/23"} %>
- <%= render partial: "filters/checkbox_filter", locals: { f: f, options: years, label: "Collection year", category: "years" } %>
- <%= render partial: "filters/checkbox_filter", locals: { f: f, options: status_filters, label: "Status", category: "status" } %>
- <%= render partial: "filters/checkbox_filter", locals: { f: f, options: {"all": "All", "yours": "Yours"}, label: "Logs", category: "user" } %>
- <%= f.govuk_submit "Apply filters", class: "govuk-!-margin-top-4" %>
- <% end %>
-
-
+
+
+
+
+ <%= form_with url: "/logs", html: { method: :get } do |f| %>
+ <% years = {"2021": "2021/22", "2022": "2022/23"} %>
+ <%= render partial: "filters/checkbox_filter", locals: { f: f, options: years, label: "Collection year", category: "years" } %>
+ <%= render partial: "filters/checkbox_filter", locals: { f: f, options: status_filters, label: "Status", category: "status" } %>
+ <%= render partial: "filters/checkbox_filter", locals: { f: f, options: {"all": "All", "yours": "Yours"}, label: "Logs", category: "user" } %>
+ <%= f.govuk_submit "Apply filters", class: "govuk-!-margin-bottom-0" %>
+ <% end %>
+
+
diff --git a/app/views/case_logs/_log_list.html.erb b/app/views/case_logs/_log_list.html.erb
index a2fe5645c..3cde563c5 100644
--- a/app/views/case_logs/_log_list.html.erb
+++ b/app/views/case_logs/_log_list.html.erb
@@ -28,21 +28,21 @@
<%= govuk_link_to log.id, case_log_path(log) %>
- <%= log.tenant_code? ? log.tenant_code : '–' %>
+ <%= log.tenant_code? ? log.tenant_code : "–" %>
|
- <%= log.propcode? ? log.propcode : '–' %>
+ <%= log.propcode? ? log.propcode : "–" %>
|
- <%= log.startdate.present? ? log.startdate.to_formatted_s(:govuk_date) : '–' %>
+ <%= log.startdate.present? ? log.startdate.to_formatted_s(:govuk_date) : "–" %>
|
<%= log.created_at.to_formatted_s(:govuk_date) %>
|
<%= govuk_tag(
- colour: log.status == 'completed' ? 'blue' : 'grey',
- text: log.status.humanize
+ colour: log.status == "completed" ? "blue" : "grey",
+ text: log.status.humanize,
) %>
|
<% if current_user.support? %>
@@ -59,4 +59,3 @@
-
diff --git a/app/views/case_logs/bulk_upload.html.erb b/app/views/case_logs/bulk_upload.html.erb
index 2ae6b94a9..1d6017972 100644
--- a/app/views/case_logs/bulk_upload.html.erb
+++ b/app/views/case_logs/bulk_upload.html.erb
@@ -5,8 +5,7 @@
<%= f.govuk_file_field :case_log_bulk_upload,
label: { text: content_for(:title), size: "l" },
- hint: { text: "Upload a spreadsheet using the template" }
- %>
+ hint: { text: "Upload a spreadsheet using the template" } %>
- <%= f.govuk_submit "Upload" %>
+ <%= f.govuk_submit "Upload" %>
<% end %>
diff --git a/app/views/case_logs/edit.html.erb b/app/views/case_logs/edit.html.erb
index 015db4454..26f3509d3 100644
--- a/app/views/case_logs/edit.html.erb
+++ b/app/views/case_logs/edit.html.erb
@@ -1,7 +1,7 @@
<% content_for :title, "Log #{@case_log.id}" %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Logs" => "/logs",
- content_for(:title) => ""
+ content_for(:title) => "",
}) %>
diff --git a/app/views/case_logs/index.html.erb b/app/views/case_logs/index.html.erb
index 8060f3c99..857b1dbd8 100644
--- a/app/views/case_logs/index.html.erb
+++ b/app/views/case_logs/index.html.erb
@@ -3,28 +3,17 @@
<%= content_for(:title) %>
-
-
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb
index bd0ae816b..b677b4c17 100644
--- a/app/views/devise/passwords/new.html.erb
+++ b/app/views/devise/passwords/new.html.erb
@@ -2,7 +2,7 @@
<% content_for :before_content do %>
<%= govuk_back_link(
- text: 'Back',
+ text: "Back",
href: :back,
) %>
<% end %>
@@ -22,8 +22,7 @@
<%= f.govuk_email_field :email,
label: { text: "Email address" },
autocomplete: "email",
- spellcheck: "false"
- %>
+ spellcheck: "false" %>
<%= f.govuk_submit "Send email" %>
diff --git a/app/views/devise/passwords/reset_password.html.erb b/app/views/devise/passwords/reset_password.html.erb
index bd96a9c5d..04353c7b2 100644
--- a/app/views/devise/passwords/reset_password.html.erb
+++ b/app/views/devise/passwords/reset_password.html.erb
@@ -2,7 +2,7 @@
<% content_for :before_content do %>
<%= govuk_back_link(
- text: 'Back',
+ text: "Back",
href: :back,
) %>
<% end %>
@@ -20,12 +20,10 @@
<%= f.govuk_password_field :password,
label: { text: "New password" },
hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil,
- autocomplete: "new-password"
- %>
+ autocomplete: "new-password" %>
<%= f.govuk_password_field :password_confirmation,
- label: { text: "Confirm new password" }
- %>
+ label: { text: "Confirm new password" } %>
<%= f.govuk_submit "Update" %>
diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb
index 9daa5fab6..aeb260b96 100644
--- a/app/views/devise/sessions/new.html.erb
+++ b/app/views/devise/sessions/new.html.erb
@@ -19,12 +19,10 @@
<%= f.govuk_email_field :email,
label: { text: "Email address" },
autocomplete: "email",
- spellcheck: "false"
- %>
+ spellcheck: "false" %>
<%= f.govuk_password_field :password,
- autocomplete: "current-password"
- %>
+ autocomplete: "current-password" %>
<%= f.hidden_field :start, value: request["start"] %>
<%= f.govuk_submit "Sign in" %>
diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb
index f66521541..05035e08b 100644
--- a/app/views/devise/shared/_links.html.erb
+++ b/app/views/devise/shared/_links.html.erb
@@ -1,25 +1,25 @@
<%- if controller_name != 'sessions' %>
-
Already have an account? <%= govuk_link_to "Sign in", new_session_path(resource_name) %>.
+
Already have an account? <%= govuk_link_to "Sign in", new_session_path(resource_name) %>.
<% end %>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
- <%= govuk_link_to "Sign up", new_registration_path(resource_name) %>
+ <%= govuk_link_to "Sign up", new_registration_path(resource_name) %>
<% end %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
-
You can <%= govuk_link_to "reset your password", new_password_path(resource_name) %> if you’ve forgotten it.
+
You can <%= govuk_link_to "reset your password", new_password_path(resource_name) %> if you’ve forgotten it.
<% end %>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
- <%= govuk_link_to "Didn’t receive confirmation instructions?", new_confirmation_path(resource_name) %>
+ <%= govuk_link_to "Didn’t receive confirmation instructions?", new_confirmation_path(resource_name) %>
<% end %>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
- <%= govuk_link_to "Didn’t receive unlock instructions?", new_unlock_path(resource_name) %>
+ <%= govuk_link_to "Didn’t receive unlock instructions?", new_unlock_path(resource_name) %>
<% end %>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
- <%= govuk_link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %>
+ <%= govuk_link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %>
<% end %>
<% end %>
diff --git a/app/views/devise/two_factor_authentication/resend.html.erb b/app/views/devise/two_factor_authentication/resend.html.erb
index c8bb5eec5..a2cc00198 100644
--- a/app/views/devise/two_factor_authentication/resend.html.erb
+++ b/app/views/devise/two_factor_authentication/resend.html.erb
@@ -2,8 +2,8 @@
<% content_for :before_content do %>
<%= govuk_back_link(
- text: 'Back',
- href: 'javascript:history.back()',
+ text: "Back",
+ href: "javascript:history.back()",
) %>
<% end %>
diff --git a/app/views/devise/two_factor_authentication/show.html.erb b/app/views/devise/two_factor_authentication/show.html.erb
index 5177f012e..55df4caeb 100644
--- a/app/views/devise/two_factor_authentication/show.html.erb
+++ b/app/views/devise/two_factor_authentication/show.html.erb
@@ -15,9 +15,8 @@
<%= f.govuk_number_field :code,
label: { text: "Security code", size: "m" },
width: 5,
- autocomplete: 'one-time-code',
- autofocus: true
- %>
+ autocomplete: "one-time-code",
+ autofocus: true %>
<%= f.govuk_submit "Submit" %>
diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb
index c20182b23..4f0de4c0b 100644
--- a/app/views/devise/unlocks/new.html.erb
+++ b/app/views/devise/unlocks/new.html.erb
@@ -6,8 +6,7 @@
<%= f.govuk_email_field :email,
label: { text: "Email address" },
autocomplete: "email",
- spellcheck: "false"
- %>
+ spellcheck: "false" %>
<%= f.govuk_submit "Resend unlock instructions" %>
<% end %>
diff --git a/app/views/filters/_checkbox_filter.html.erb b/app/views/filters/_checkbox_filter.html.erb
index c49156be7..cbbf5c39d 100644
--- a/app/views/filters/_checkbox_filter.html.erb
+++ b/app/views/filters/_checkbox_filter.html.erb
@@ -1,10 +1,8 @@
-<%= f.govuk_check_boxes_fieldset category.to_sym, legend: { text: label, size: "s"} do %>
-
- <% options.map do |key, option| %>
- <%= f.govuk_check_box category, "#{key}",
- label: { text: option },
- checked: filter_selected?(category, key),
- size: "s" %>
- <% end %>
-
+<%= f.govuk_check_boxes_fieldset category.to_sym, legend: { text: label, size: "s" }, small: true, form_group: { classes: "app-filter__group" } do %>
+ <% options.map do |key, option| %>
+ <%= f.govuk_check_box category, key.to_s,
+ label: { text: option },
+ checked: filter_selected?(category, key),
+ size: "s" %>
+ <% end %>
<% end %>
diff --git a/app/views/form/_check_answers_table.html.erb b/app/views/form/_check_answers_table.html.erb
index ae22a0c14..c34c868e0 100644
--- a/app/views/form/_check_answers_table.html.erb
+++ b/app/views/form/_check_answers_table.html.erb
@@ -1,11 +1,11 @@
- <%= question.check_answer_label.to_s.present? ? question.check_answer_label.to_s : question.header.to_s %>
+ <%= question.check_answer_label.to_s.presence || question.header.to_s %>
- <%= get_answer_label(question, @case_log) %>
+ <%= get_answer_label(question, @case_log) %>
<% question.get_inferred_answers(@case_log).each do |inferred_answer| %>
- <%= inferred_answer %>
+ <%= inferred_answer %>
<% end %>
diff --git a/app/views/form/_checkbox_question.html.erb b/app/views/form/_checkbox_question.html.erb
index 3c1bb0da9..99551bac1 100644
--- a/app/views/form/_checkbox_question.html.erb
+++ b/app/views/form/_checkbox_question.html.erb
@@ -12,12 +12,11 @@
<%= f.govuk_check_box_divider %>
<% else %>
<%= f.govuk_check_box question.id, key,
- label: { text: options['value'] },
- hint: { text: options['hint'] },
+ label: { text: options["value"] },
+ hint: { text: options["hint"] },
checked: @case_log[key] == 1,
exclusive: after_divider,
- **stimulus_html_attributes(question)
- %>
+ **stimulus_html_attributes(question) %>
<% end %>
<% end %>
<% end %>
diff --git a/app/views/form/_date_question.html.erb b/app/views/form/_date_question.html.erb
index c453e1019..c9862037d 100644
--- a/app/views/form/_date_question.html.erb
+++ b/app/views/form/_date_question.html.erb
@@ -1,9 +1,8 @@
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %>
<%= f.govuk_date_field question.id.to_sym,
- caption: caption(caption_text, page_header, conditional),
- legend: legend(question, page_header, conditional),
- hint: { text: question.hint_text&.html_safe },
- width: 20,
- **stimulus_html_attributes(question)
-%>
+ caption: caption(caption_text, page_header, conditional),
+ legend: legend(question, page_header, conditional),
+ hint: { text: question.hint_text&.html_safe },
+ width: 20,
+ **stimulus_html_attributes(question) %>
diff --git a/app/views/form/_interruption_screen_question.html.erb b/app/views/form/_interruption_screen_question.html.erb
index 36c797064..8913aa1e7 100644
--- a/app/views/form/_interruption_screen_question.html.erb
+++ b/app/views/form/_interruption_screen_question.html.erb
@@ -1,6 +1,6 @@
<%= govuk_panel(
- title_text: title_text,
- classes: 'app-panel--interruption',
+ title_text:,
+ classes: "app-panel--interruption",
) do %>
<%= display_informative_text(informative_text, case_log) %>
<%= f.govuk_radio_buttons_fieldset question.id.to_sym,
@@ -12,12 +12,11 @@
<% else %>
<%= f.govuk_radio_button question.id,
key,
- label: { text: options['value'] },
- hint: { text: options['hint'] },
- **stimulus_html_attributes(question)
- %>
+ label: { text: options["value"] },
+ hint: { text: options["hint"] },
+ **stimulus_html_attributes(question) %>
<% end %>
<% end %>
<% end %>
<%= f.govuk_submit "Save and continue", accesskey: "s", class: "app-button--inverse govuk-!-margin-bottom-0" %>
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/form/_numeric_output_question.html.erb b/app/views/form/_numeric_output_question.html.erb
index 01527be09..e3019a62c 100644
--- a/app/views/form/_numeric_output_question.html.erb
+++ b/app/views/form/_numeric_output_question.html.erb
@@ -15,7 +15,7 @@
step="<%= question.step %>"
type="number"
name="case_log[tcharge]"
- for="<%= question.fields_added.present? ? question.fields_added.map { |x| "case-log-#{x}-field"}.join(" ") : "" %>">
+ for="<%= question.fields_added.present? ? question.fields_added.map { |x| "case-log-#{x}-field" }.join(" ") : "" %>">
<%= case_log[question.id] %>
<%= question.suffix %>
diff --git a/app/views/form/_numeric_question.html.erb b/app/views/form/_numeric_question.html.erb
index 1e9702310..c392ebaf1 100644
--- a/app/views/form/_numeric_question.html.erb
+++ b/app/views/form/_numeric_question.html.erb
@@ -1,12 +1,12 @@
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %>
<%= f.govuk_number_field question.id.to_sym,
- caption: caption(caption_text, page_header, conditional),
- label: legend(question, page_header, conditional),
- hint: { text: question.hint_text&.html_safe },
- min: question.min, max: question.max, step: question.step,
- width: question.width, :readonly => question.read_only?,
- prefix_text: question.prefix.to_s,
- suffix_text: question.suffix.is_a?(String) ? question.suffix : nil,
- **stimulus_html_attributes(question)
-%>
+ caption: caption(caption_text, page_header, conditional),
+ label: legend(question, page_header, conditional),
+ hint: { text: question.hint_text&.html_safe },
+ min: question.min, max: question.max, step: question.step,
+ width: question.width,
+ readonly: question.read_only?,
+ prefix_text: question.prefix.to_s,
+ suffix_text: question.suffix.is_a?(String) ? question.suffix : nil,
+ **stimulus_html_attributes(question) %>
diff --git a/app/views/form/_radio_question.html.erb b/app/views/form/_radio_question.html.erb
index 12a8052b1..a79e9422d 100644
--- a/app/views/form/_radio_question.html.erb
+++ b/app/views/form/_radio_question.html.erb
@@ -1,37 +1,36 @@
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %>
<%= f.govuk_radio_buttons_fieldset question.id.to_sym,
- caption: caption(caption_text, page_header, conditional),
- legend: legend(question, page_header, conditional),
- hint: { text: question.hint_text&.html_safe } do %>
+ caption: caption(caption_text, page_header, conditional),
+ legend: legend(question, page_header, conditional),
+ hint: { text: question.hint_text&.html_safe } do %>
- <% question.displayed_answer_options.map do |key, options| %>
- <% if key.starts_with?("divider") %>
- <%= f.govuk_radio_divider %>
+ <% question.displayed_answer_options.map do |key, options| %>
+ <% if key.starts_with?("divider") %>
+ <%= f.govuk_radio_divider %>
+ <% else %>
+ <% conditional_question = find_conditional_question(@page, question, key) %>
+ <% if conditional_question.nil? %>
+ <%= f.govuk_radio_button question.id,
+ key,
+ label: { text: options["value"] },
+ hint: { text: options["hint"] },
+ **stimulus_html_attributes(question) %>
<% else %>
- <% conditional_question = find_conditional_question(@page, question, key) %>
- <% if conditional_question.nil? %>
- <%= f.govuk_radio_button question.id,
- key,
- label: { text: options['value'] },
- hint: { text: options['hint'] },
- **stimulus_html_attributes(question)
- %>
- <% else %>
- <%= f.govuk_radio_button question.id,
- key,
- label: { text: options['value'] },
- hint: { text: options['hint'] },
- **stimulus_html_attributes(question) do %>
- <%= render partial: "#{conditional_question.type}_question", locals: {
- question: conditional_question,
- caption_text: caption_text,
- page_header: page_header,
- f: f,
- conditional: true
- } %>
- <% end %>
+ <%= f.govuk_radio_button question.id,
+ key,
+ label: { text: options["value"] },
+ hint: { text: options["hint"] },
+ **stimulus_html_attributes(question) do %>
+ <%= render partial: "#{conditional_question.type}_question", locals: {
+ question: conditional_question,
+ caption_text:,
+ page_header:,
+ f:,
+ conditional: true,
+ } %>
<% end %>
<% end %>
<% end %>
+ <% end %>
<% end %>
diff --git a/app/views/form/_select_question.html.erb b/app/views/form/_select_question.html.erb
index 88a080bda..b5c6d94a9 100644
--- a/app/views/form/_select_question.html.erb
+++ b/app/views/form/_select_question.html.erb
@@ -1,14 +1,13 @@
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %>
<% selected = @case_log.public_send(question.id) || "" %>
-<%= answers = question.displayed_answer_options.map { |key, value| OpenStruct.new(id: key, name: value) }
- f.govuk_collection_select question.id.to_sym,
+<% answers = question.displayed_answer_options.map { |key, value| OpenStruct.new(id: key, name: value) } %>
+ <%= f.govuk_collection_select question.id.to_sym,
answers,
:id,
:name,
caption: caption(caption_text, page_header, conditional),
label: legend(question, page_header, conditional),
hint: { text: question.hint_text&.html_safe },
- options: { disabled: [""], selected: selected },
- "data-controller": "accessible-autocomplete"
- %>
+ options: { disabled: [""], selected: },
+ "data-controller": "accessible-autocomplete" %>
diff --git a/app/views/form/_text_question.html.erb b/app/views/form/_text_question.html.erb
index 1fb67b84a..4b11bea36 100644
--- a/app/views/form/_text_question.html.erb
+++ b/app/views/form/_text_question.html.erb
@@ -1,9 +1,8 @@
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %>
<%= f.govuk_text_field question.id.to_sym,
- caption: caption(caption_text, page_header, conditional),
- label: legend(question, page_header, conditional),
- hint: { text: question.hint_text&.html_safe },
- width: question.width ? question.width : nil,
- **stimulus_html_attributes(question)
-%>
+ caption: caption(caption_text, page_header, conditional),
+ label: legend(question, page_header, conditional),
+ hint: { text: question.hint_text&.html_safe },
+ width: question.width || nil,
+ **stimulus_html_attributes(question) %>
diff --git a/app/views/form/_textarea_question.html.erb b/app/views/form/_textarea_question.html.erb
index 59a8ca163..e87cb558b 100644
--- a/app/views/form/_textarea_question.html.erb
+++ b/app/views/form/_textarea_question.html.erb
@@ -1,9 +1,8 @@
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %>
<%= f.govuk_text_area question.id.to_sym,
- caption: caption(caption_text, page_header, conditional),
- label: legend(question, page_header, conditional),
- hint: { text: question.hint_text&.html_safe },
- width: question.width ? question.width : nil,
- **stimulus_html_attributes(question)
-%>
+ caption: caption(caption_text, page_header, conditional),
+ label: legend(question, page_header, conditional),
+ hint: { text: question.hint_text&.html_safe },
+ width: question.width || nil,
+ **stimulus_html_attributes(question) %>
diff --git a/app/views/form/check_answers.html.erb b/app/views/form/check_answers.html.erb
index c4c8b023c..94f5757b6 100644
--- a/app/views/form/check_answers.html.erb
+++ b/app/views/form/check_answers.html.erb
@@ -1,8 +1,8 @@
<% content_for :title, "#{subsection.id.humanize} - Check your answers" %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Logs" => "/logs",
- "Log #{@case_log.id.to_s}" => "/logs/" + @case_log.id.to_s,
- subsection.label => ""
+ "Log #{@case_log.id}" => "/logs/#{@case_log.id}",
+ subsection.label => "",
}) %>
@@ -16,17 +16,17 @@
<% subsection.applicable_questions(@case_log).each do |question| %>
- <%= render partial: 'form/check_answers_table', locals: { question: question, case_log: @case_log } %>
+ <%= render partial: "form/check_answers_table", locals: { question:, case_log: @case_log } %>
<% end %>
<%= form_with model: @case_log, method: "get" do |f| %>
- <%= f.govuk_submit 'Save and return to log' do %>
+ <%= f.govuk_submit "Save and return to log" do %>
<% if @case_log.status == "in_progress" && @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) == false %>
- <%= govuk_button_link_to 'Save and go to next incomplete section', "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %>
+ <%= govuk_button_link_to "Save and go to next incomplete section", "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %>
<% elsif @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) %>
- <%= govuk_button_link_to 'Save and go to submit', "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %>
- <% end%>
+ <%= govuk_button_link_to "Save and go to submit", "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %>
+ <% end %>
<% end %>
<% end %>
diff --git a/app/views/form/guidance/_what_counts_as_income.html.erb b/app/views/form/guidance/_what_counts_as_income.html.erb
index 79326d909..55362d941 100644
--- a/app/views/form/guidance/_what_counts_as_income.html.erb
+++ b/app/views/form/guidance/_what_counts_as_income.html.erb
@@ -1,4 +1,4 @@
-<%= govuk_details(summary_text: 'What counts as income?') do %>
+<%= govuk_details(summary_text: "What counts as income?") do %>
You should include any income after tax from:
diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json
index c3a7c46d6..828f3e2ec 100644
--- a/config/forms/2021_2022.json
+++ b/config/forms/2021_2022.json
@@ -22,7 +22,7 @@
"1": {
"value": "General needs"
},
- "0": {
+ "2": {
"value": "Supported housing"
}
}
@@ -90,12 +90,12 @@
}
},
"conditional_for": {
- "intermediate_rent_product_name": [
+ "irproduct_other": [
5
]
}
},
- "intermediate_rent_product_name": {
+ "irproduct_other": {
"check_answer_label": "Product name",
"header": "Name of rent product",
"type": "text"
@@ -587,13 +587,13 @@
"type": "radio",
"answer_options": {
"1": {
- "value": "Affordable rent basis"
+ "value": "Social rent basis"
},
"2": {
- "value": "Intermediate rent basis"
+ "value": "Affordable rent basis"
},
- "0": {
- "value": "Social rent basis"
+ "4": {
+ "value": "Intermediate rent basis"
},
"divider": {
"value": true
@@ -621,39 +621,39 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "1": {
+ "13": {
"value": "Internal transfer",
"hint": "Excluding renewals of a fixed-term tenancy"
},
- "10": {
+ "5": {
"value": "Previous tenant died with no succession"
},
- "2": {
+ "9": {
"value": "Re-let to tenant who occupied same property as temporary accommodation"
},
- "0": {
+ "14": {
"value": "Renewal of fixed-term tenancy"
},
- "7": {
- "value": "Tenant abandoned property"
- },
- "3": {
+ "19": {
"value": "Tenant involved in a succession downsize"
},
- "6": {
- "value": "Tenant moved to care home"
+ "8": {
+ "value": "Tenant moved to private sector or other accommodation"
},
- "5": {
+ "12": {
"value": "Tenant moved to other social housing provider"
},
- "4": {
- "value": "Tenant moved to private sector or other accommodation"
+ "18": {
+ "value": "Tenant moved to care home"
},
- "9": {
- "value": "Tenant was evicted due to anti-social behaviour"
+ "6": {
+ "value": "Tenant abandoned property"
},
- "8": {
+ "10": {
"value": "Tenant was evicted due to rent arrears"
+ },
+ "11": {
+ "value": "Tenant was evicted due to anti-social behaviour"
}
}
}
@@ -675,14 +675,14 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "15": {
- "value": "First let of new-build property"
- },
"16": {
"value": "First let of conversion, rehabilitation or acquired property"
},
"17": {
"value": "First let of leased property"
+ },
+ "15": {
+ "value": "First let of new-build property"
}
}
}
@@ -748,28 +748,28 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "1": {
+ "2": {
"value": "Bedsit"
},
- "3": {
+ "8": {
"value": "Bungalow"
},
- "0": {
+ "1": {
"value": "Flat or maisonette"
},
- "2": {
+ "7": {
"value": "House"
},
- "6": {
+ "10": {
"value": "Shared bungalow"
},
"4": {
"value": "Shared flat or maisonette"
},
- "5": {
+ "9": {
"value": "Shared house"
},
- "7": {
+ "6": {
"value": "Other"
}
}
@@ -786,10 +786,10 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "1": {
+ "2": {
"value": "Converted from previous residential or non-residential property"
},
- "0": {
+ "1": {
"value": "Purpose built"
}
}
@@ -806,10 +806,10 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": {
+ "1": {
"value": "Yes"
},
- "1": {
+ "2": {
"value": "No"
}
}
@@ -841,7 +841,7 @@
"header": "",
"description": "",
"questions": {
- "property_void_date": {
+ "voiddate": {
"check_answer_label": "Void or renewal date",
"header": "What is the void or renewal date?",
"hint_text": "For example, 27 3 2021.",
@@ -863,7 +863,7 @@
"header": "",
"description": "",
"questions": {
- "property_void_date": {
+ "voiddate": {
"check_answer_label": "New-build handover date",
"header": "What is the new-build handover date?",
"hint_text": "",
@@ -938,10 +938,10 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": {
+ "1": {
"value": "Yes"
},
- "1": {
+ "2": {
"value": "No"
}
}
@@ -958,25 +958,25 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": {
+ "2": {
"value": "Assured"
},
- "1": {
+ "4": {
"value": "Assured Shorthold"
},
- "2": {
+ "5": {
"value": "Licence agreement (almshouses only)"
},
- "3": {
+ "1": {
"value": "Secure (including flexible)"
},
- "4": {
+ "3": {
"value": "Other"
}
},
"conditional_for": {
"tenancyother": [
- 4
+ 3
]
}
},
@@ -1002,25 +1002,25 @@
"hint_text": "This is also known as an ‘introductory period’.",
"type": "radio",
"answer_options": {
- "0": {
+ "2": {
"value": "Assured"
},
- "1": {
+ "4": {
"value": "Assured Shorthold"
},
- "2": {
+ "5": {
"value": "Licence agreement (almshouses only)"
},
- "3": {
+ "1": {
"value": "Secure (including flexible)"
},
- "4": {
+ "3": {
"value": "Other"
}
},
"conditional_for": {
"tenancyother": [
- 4
+ 3
]
}
},
@@ -1053,10 +1053,10 @@
},
"depends_on": [
{
- "tenancy": 3
+ "tenancy": 1
},
{
- "tenancy": 1
+ "tenancy": 4
}
]
},
@@ -1064,25 +1064,25 @@
"header": "",
"description": "",
"questions": {
- "letting_in_sheltered_accommodation": {
+ "shelteredaccom": {
"check_answer_label": "Is this letting in sheltered accommodation?",
"header": "Is this letting in sheltered accommodation?",
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": {
+ "1": {
"value": "Yes – sheltered housing"
},
- "1": {
+ "2": {
"value": "Yes – extra care housing"
},
- "2": {
+ "3": {
"value": "No"
},
"divider": {
"value": true
},
- "3": {
+ "4": {
"value": "Don’t know"
}
}
@@ -1090,7 +1090,7 @@
},
"depends_on": [
{
- "needstype": 0
+ "needstype": 2
}
]
}
@@ -1243,7 +1243,7 @@
"divider": {
"value": true
},
- "5": {
+ "17": {
"value": "Tenant prefers not to say"
}
}
@@ -1260,16 +1260,16 @@
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
"answer_options": {
- "0": {
+ "19": {
"value": "Arab"
},
- "1": {
+ "16": {
"value": "Other ethnic group"
}
},
"conditional_for": {
"ethnic_other": [
- 1
+ 16
]
}
},
@@ -1295,25 +1295,25 @@
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
"answer_options": {
- "0": {
+ "10": {
"value": "Bangladeshi"
},
- "1": {
+ "15": {
"value": "Chinese"
},
- "2": {
+ "8": {
"value": "Indian"
},
- "3": {
+ "9": {
"value": "Pakistani"
},
- "4": {
+ "11": {
"value": "Other ethnic group"
}
},
"conditional_for": {
"ethnic_other": [
- 4
+ 11
]
}
},
@@ -1339,13 +1339,13 @@
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
"answer_options": {
- "0": {
+ "13": {
"value": "African"
},
- "1": {
+ "12": {
"value": "Caribbean"
},
- "2": {
+ "14": {
"value": "Any other Black, African or Caribbean background"
}
},
@@ -1377,19 +1377,22 @@
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
"answer_options": {
- "0": {
+ "4": {
"value": "White and Black Caribbean"
},
- "1": {
+ "5": {
"value": "White and Black African"
},
- "2": {
+ "6": {
+ "value": "White and Asian"
+ },
+ "7": {
"value": "Any other Mixed or Multiple ethnic background"
}
},
"conditional_for": {
"ethnic_other": [
- 2
+ 7
]
}
},
@@ -1415,17 +1418,14 @@
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
"answer_options": {
- "0": {
+ "1": {
"value": "English, Welsh, Northern Irish, Scottish or British"
},
- "1": {
+ "2": {
"value": "Irish"
},
- "2": {
+ "18": {
"value": "Gypsy or Irish Traveller"
- },
- "3": {
- "value": "Any other White background"
}
},
"conditional_for": {
@@ -1579,25 +1579,25 @@
},
"depends_on": [
{
- "other_hhmemb": 1
+ "hhmemb": 2
},
{
- "other_hhmemb": 2
+ "hhmemb": 3
},
{
- "other_hhmemb": 3
+ "hhmemb": 4
},
{
- "other_hhmemb": 4
+ "hhmemb": 5
},
{
- "other_hhmemb": 5
+ "hhmemb": 6
},
{
- "other_hhmemb": 6
+ "hhmemb": 7
},
{
- "other_hhmemb": 7
+ "hhmemb": 8
}
]
},
@@ -1792,22 +1792,22 @@
},
"depends_on": [
{
- "other_hhmemb": 2
+ "hhmemb": 3
},
{
- "other_hhmemb": 3
+ "hhmemb": 4
},
{
- "other_hhmemb": 4
+ "hhmemb": 5
},
{
- "other_hhmemb": 5
+ "hhmemb": 6
},
{
- "other_hhmemb": 6
+ "hhmemb": 7
},
{
- "other_hhmemb": 7
+ "hhmemb": 8
}
]
},
@@ -2002,19 +2002,19 @@
},
"depends_on": [
{
- "other_hhmemb": 3
+ "hhmemb": 4
},
{
- "other_hhmemb": 4
+ "hhmemb": 5
},
{
- "other_hhmemb": 5
+ "hhmemb": 6
},
{
- "other_hhmemb": 6
+ "hhmemb": 7
},
{
- "other_hhmemb": 7
+ "hhmemb": 8
}
]
},
@@ -2209,16 +2209,16 @@
},
"depends_on": [
{
- "other_hhmemb": 4
+ "hhmemb": 5
},
{
- "other_hhmemb": 5
+ "hhmemb": 6
},
{
- "other_hhmemb": 6
+ "hhmemb": 7
},
{
- "other_hhmemb": 7
+ "hhmemb": 8
}
]
},
@@ -2413,13 +2413,13 @@
},
"depends_on": [
{
- "other_hhmemb": 5
+ "hhmemb": 6
},
{
- "other_hhmemb": 6
+ "hhmemb": 7
},
{
- "other_hhmemb": 7
+ "hhmemb": 8
}
]
},
@@ -2614,10 +2614,10 @@
},
"depends_on": [
{
- "other_hhmemb": 6
+ "hhmemb": 7
},
{
- "other_hhmemb": 7
+ "hhmemb": 8
}
]
},
@@ -2812,7 +2812,7 @@
},
"depends_on": [
{
- "other_hhmemb": 7
+ "hhmemb": 8
}
]
},
@@ -3007,22 +3007,22 @@
"type": "radio",
"check_answer_label": "Household links to UK armed forces",
"answer_options": {
- "0": {
+ "1": {
"value": "Yes – the person is a current or former regular"
},
- "1": {
+ "4": {
"value": "Yes – the person is a current or former reserve"
},
- "2": {
+ "5": {
"value": "Yes – the person is a spouse or civil partner of a UK armed forces member and has been bereaved or separated from them within the last 2 years"
},
- "3": {
+ "2": {
"value": "No"
},
"divider": {
"value": true
},
- "4": {
+ "3": {
"value": "Person prefers not to say"
}
}
@@ -3034,7 +3034,7 @@
"description": "",
"depends_on": [
{
- "armedforces": 0
+ "armedforces": 1
}
],
"questions": {
@@ -3068,10 +3068,10 @@
"description": "",
"depends_on": [
{
- "armedforces": 0
+ "armedforces": 1
},
{
- "armedforces": 1
+ "armedforces": 4
}
],
"questions": {
@@ -3107,16 +3107,16 @@
"type": "radio",
"check_answer_label": "Anybody in household pregnant",
"answer_options": {
- "0": {
+ "1": {
"value": "Yes"
},
- "1": {
+ "2": {
"value": "No"
},
"divider": {
"value": true
},
- "2": {
+ "3": {
"value": "Tenant prefers not to say"
}
}
@@ -3168,16 +3168,16 @@
"type": "radio",
"check_answer_label": "Anybody in household with physical or mental health condition",
"answer_options": {
- "0": {
+ "1": {
"value": "Yes"
},
- "1": {
+ "2": {
"value": "No"
},
"divider": {
"value": true
},
- "2": {
+ "3": {
"value": "Tenant prefers not to say"
}
}
@@ -3189,7 +3189,7 @@
"description": "",
"depends_on": [
{
- "illness": 0
+ "illness": 1
}
],
"questions": {
@@ -3299,37 +3299,37 @@
"header": "",
"description": "",
"questions": {
- "lawaitlist": {
+ "waityear": {
"check_answer_label": "Length of time on local authority waiting list",
"header": "How long has the household been on the local authority waiting list for the new letting?",
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": {
+ "1": {
"value": "Just moved to local authority area"
},
- "1": {
+ "2": {
"value": "Less than 1 year"
},
- "2": {
+ "7": {
"value": "1 year but under 2 years"
},
- "3": {
+ "8": {
"value": "2 years but under 3 years"
},
- "4": {
+ "9": {
"value": "3 years but under 4 years"
},
- "5": {
+ "10": {
"value": "4 years but under 5 years"
},
- "6": {
+ "5": {
"value": "5 years or more"
},
"divider": {
"value": true
},
- "7": {
+ "6": {
"value": "Don’t know"
}
}
@@ -3452,18 +3452,15 @@
},
"28": {
"value": "Don’t know"
- },
- "10000": {
- "value": "Tenant prefers not to say"
}
},
"conditional_for": {
- "other_reason_for_leaving_last_settled_home": [
- 31
+ "reasonother": [
+ 20
]
}
},
- "other_reason_for_leaving_last_settled_home": {
+ "reasonother": {
"header": "What is the reason?",
"hint_text": "",
"type": "text"
@@ -3610,7 +3607,7 @@
"depends_on": [
{
"renewal": 1,
- "needstype": 0
+ "needstype": 2
}
]
},
@@ -4406,7 +4403,7 @@
"depends_on": [
{
"managing_organisation.provider_type": "LA",
- "needstype": 0,
+ "needstype": 2,
"renewal": 0
}
]
@@ -4466,7 +4463,7 @@
"depends_on": [
{
"managing_organisation.provider_type": "PRP",
- "needstype": 0,
+ "needstype": 2,
"renewal": 0
}
]
@@ -4535,19 +4532,19 @@
{
"label": "every week",
"depends_on": {
- "incfreq": 0
+ "incfreq": 1
}
},
{
"label": "every month",
"depends_on": {
- "incfreq": 1
+ "incfreq": 2
}
},
{
- "label": "every month",
+ "label": "every year",
"depends_on": {
- "incfreq": 2
+ "incfreq": 3
}
}
]
@@ -4558,13 +4555,13 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": {
+ "1": {
"value": "Weekly"
},
- "1": {
+ "2": {
"value": "Monthly"
},
- "2": {
+ "3": {
"value": "Yearly"
}
},
@@ -4626,9 +4623,6 @@
},
"3": {
"value": "Don’t know"
- },
- "6": {
- "value": "Tenant prefers not to say"
}
}
}
@@ -4644,19 +4638,19 @@
"hint_text": "This excludes child and housing benefit, council tax support and tax credits.",
"type": "radio",
"answer_options": {
- "0": {
+ "1": {
"value": "All"
},
- "1": {
+ "2": {
"value": "Some"
},
- "2": {
+ "3": {
"value": "None"
},
"divider": {
"value": true
},
- "3": {
+ "4": {
"value": "Don’t know"
}
}
@@ -4684,7 +4678,7 @@
},
"depends_on": [
{
- "needstype": 0
+ "needstype": 2
}
]
},
@@ -4774,62 +4768,62 @@
"depends_on": [
{
"period": 1,
- "needstype": 0,
+ "needstype": 2,
"household_charge": 0
},
{
"period": 1,
- "needstype": 0,
+ "needstype": 2,
"household_charge": null
},
{
"period": 5,
- "needstype": 0,
+ "needstype": 2,
"household_charge": 0
},
{
"period": 5,
- "needstype": 0,
+ "needstype": 2,
"household_charge": null
},
{
"period": 6,
- "needstype": 0,
+ "needstype": 2,
"household_charge": 0
},
{
"period": 6,
- "needstype": 0,
+ "needstype": 2,
"household_charge": null
},
{
"period": 7,
- "needstype": 0,
+ "needstype": 2,
"household_charge": 0
},
{
"period": 7,
- "needstype": 0,
+ "needstype": 2,
"household_charge": null
},
{
"period": 8,
- "needstype": 0,
+ "needstype": 2,
"household_charge": 0
},
{
"period": 8,
- "needstype": 0,
+ "needstype": 2,
"household_charge": null
},
{
"period": 9,
- "needstype": 0,
+ "needstype": 2,
"household_charge": 0
},
{
"period": 9,
- "needstype": 0,
+ "needstype": 2,
"household_charge": null
}
]
@@ -4871,12 +4865,12 @@
"depends_on": [
{
"period": 2,
- "needstype": 0,
+ "needstype": 2,
"household_charge": 0
},
{
"period": 2,
- "needstype": 0,
+ "needstype": 2,
"household_charge": null
}
]
@@ -4918,12 +4912,12 @@
"depends_on": [
{
"period": 3,
- "needstype": 0,
+ "needstype": 2,
"household_charge": 0
},
{
"period": 3,
- "needstype": 0,
+ "needstype": 2,
"household_charge": null
}
]
@@ -4965,12 +4959,12 @@
"depends_on": [
{
"period": 4,
- "needstype": 0,
+ "needstype": 2,
"household_charge": 0
},
{
"period": 4,
- "needstype": 0,
+ "needstype": 2,
"household_charge": null
}
]
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 3e024df62..076f547bf 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -93,34 +93,34 @@ en:
benefits:
part_or_full_time: "Answer cannot be 'all' for income from Universal Credit, state pensions or benefits if the tenant or their partner works part-time or full-time"
earnings:
- over_hard_max: "Net income cannot be greater than %{hard_max} given the tenant’s working situation"
- under_hard_min: "Net income cannot be less than %{hard_min} given the tenant’s working situation"
+ over_hard_max: "Net income cannot be greater than £%{hard_max} per week given the tenant’s working situation"
+ under_hard_min: "Net income cannot be less than £%{hard_min} per week given the tenant’s working situation"
freq_missing: "Select how often the household receives income"
earnings_missing: "Enter how much income the household has in total"
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 the same and it is a general needs letting"
- supported_housing: "Service charge must be between £0 and £280 per week if the landlord is the same and it is a supported housing letting"
- other_landlord:
- general_needs: "Service charge must be between £0 and £45 per week if the landlord is another registered provider and it is a general needs letting"
- supported_housing: "Service charge must be between £0 and £165 per week if the landlord is another registered provider and it is a supported housing letting"
+ private_registered_provider:
+ general_needs: "Service charge must be between £0 and £55 per week if the landlord is a private registered provider and it is a general needs letting"
+ supported_housing: "Service charge must be between £0 and £280 per week if the landlord is a private registered provider and it is a supported housing letting"
+ local_authority:
+ general_needs: "Service charge must be between £0 and £45 per week if the landlord is a local authority and it is a general needs letting"
+ supported_housing: "Service charge must be between £0 and £165 per week if the landlord is a local authority and it is a supported housing letting"
pscharge:
- this_landlord:
- general_needs: "Personal service charge must be between £0 and £30 per week if the landlord is the same and it is a general needs letting"
- supported_housing: "Personal service charge must be between £0 and £200 per week if the landlord is the same and it is a supported housing letting"
- other_landlord:
- general_needs: "Personal service charge must be between £0 and £35 per week if the landlord is another registered provider 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 registered provider and it is a supported housing letting"
+ private_registered_provider:
+ general_needs: "Personal service charge must be between £0 and £30 per week if the landlord is a private registered provider and it is a general needs letting"
+ supported_housing: "Personal service charge must be between £0 and £200 per week if the landlord is a private registered provider and it is a supported housing letting"
+ local_authority:
+ general_needs: "Personal service charge must be between £0 and £35 per week if the landlord is a local authority and it is a general needs letting"
+ supported_housing: "Personal service charge must be between £0 and £75 per week if the landlord is a local authority and it is a supported housing letting"
supcharg:
- this_landlord:
- general_needs: "Support charge must be between £0 and £40 per week if the landlord is the same and it is a general needs letting"
- supported_housing: "Support charge must be between £0 and £465 per week if the landlord is the same and it is a supported housing letting"
- other_landlord:
- general_needs: "Support charge must be between £0 and £60 per week if the landlord is another registered provider and it is a general needs letting"
- supported_housing: "Support charge must be between £0 and £120 per week if the landlord is another registered provider and it is a supported housing letting"
+ private_registered_provider:
+ general_needs: "Support charge must be between £0 and £40 per week if the landlord is a private registered provider and it is a general needs letting"
+ supported_housing: "Support charge must be between £0 and £465 per week if the landlord is a private registered provider and it is a supported housing letting"
+ local_authority:
+ general_needs: "Support charge must be between £0 and £60 per week if the landlord is a local authority and it is a general needs letting"
+ supported_housing: "Support charge must be between £0 and £120 per week if the landlord is a local authority and it is a supported housing letting"
brent:
not_in_range: "Basic rent is outside of the expected range based on the lettings type, local authority and number of bedrooms"
la:
@@ -183,7 +183,7 @@ en:
male_refuge: "Answer cannot be refuge as the lead tenant identifies as male"
internal_transfer: "Answer cannot be %{prevten} as you already told us this tenancy is an internal transfer"
la_general_needs:
- internal_transfer: "Answer cannot be a fixed-term or lifetime local authority general needs tenancy as you already told us it's the same landlord on the tenancy agreement and it is an internal transfer"
+ internal_transfer: "Answer cannot be a fixed-term or lifetime local authority general needs tenancy as you already told us it's a private registered provider on the tenancy agreement and it is an internal transfer"
referral:
secure_tenancy: "Answer must be internal transfer as you already told us this is a secure tenancy"
rsnvac_non_temp: "Answer cannot be this source of referral as you already told us this is a re-let to tenant who occupied the same property as temporary accommodation"
@@ -195,7 +195,7 @@ en:
la_general_needs:
internal_transfer: "Answer cannot be internal transfer as you already told us it's the same landlord on the tenancy agreement and the household had either a fixed-term or lifetime local authority general needs tenancy immediately before this letting"
prp:
- local_housing_referral: "Answer cannot be 'nominated by a local housing authority' as you already told us it's another landlord on the tenancy agreement"
+ local_housing_referral: "Answer cannot be 'nominated by a local housing authority' as you already told us it is a local authority on the tenancy agreement"
homeless:
assessed:
internal_transfer: "Answer cannot be assessed as homeless as you already told us this tenancy is an internal transfer"
diff --git a/db/migrate/202202071123100_additional_user_fields2.rb b/db/migrate/20220207112310_additional_user_fields2.rb
similarity index 100%
rename from db/migrate/202202071123100_additional_user_fields2.rb
rename to db/migrate/20220207112310_additional_user_fields2.rb
diff --git a/db/migrate/20220411092231_update_case_logs_fields.rb b/db/migrate/20220411092231_update_case_logs_fields.rb
new file mode 100644
index 000000000..09b83e633
--- /dev/null
+++ b/db/migrate/20220411092231_update_case_logs_fields.rb
@@ -0,0 +1,13 @@
+class UpdateCaseLogsFields < ActiveRecord::Migration[7.0]
+ def change
+ change_table :case_logs, bulk: true do |t|
+ t.integer :old_form_id, :lar, :irproduct
+ t.remove :day, :month, :year, :vday, :vmonth, :vyear, :mrcday, :mrcmonth, :mrcyear, :other_hhmemb, :accessibility_requirements_prefer_not_to_say, :landlord, type: :integer
+ t.remove :ppostc1, :ppostc2, :postcode, :postcod2, type: :string
+ t.rename :intermediate_rent_product_name, :irproduct_other
+ t.rename :lawaitlist, :waityear
+ t.rename :other_reason_for_leaving_last_settled_home, :reasonother
+ t.rename :property_void_date, :voiddate
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 882dde6f6..435d9fbd6 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.0].define(version: 202202071123100) do
+ActiveRecord::Schema[7.0].define(version: 2022_04_11_092231) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -86,7 +86,6 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do
t.integer "startertenancy"
t.integer "tenancylength"
t.integer "tenancy"
- t.integer "landlord"
t.string "ppostcode_full"
t.integer "rsnvac"
t.integer "unittype_gn"
@@ -98,20 +97,19 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do
t.integer "benefits"
t.integer "period"
t.integer "layear"
- t.integer "lawaitlist"
+ t.integer "waityear"
t.string "postcode_full"
t.integer "reasonpref"
t.integer "cbl"
t.integer "chr"
t.integer "cap"
- t.string "other_reason_for_leaving_last_settled_home"
+ t.string "reasonother"
t.integer "housingneeds_a"
t.integer "housingneeds_b"
t.integer "housingneeds_c"
t.integer "housingneeds_f"
t.integer "housingneeds_g"
t.integer "housingneeds_h"
- t.integer "accessibility_requirements_prefer_not_to_say"
t.integer "illness_type_1"
t.integer "illness_type_2"
t.integer "illness_type_3"
@@ -132,7 +130,7 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do
t.string "property_owner_organisation"
t.string "property_manager_organisation"
t.string "sale_or_letting"
- t.string "intermediate_rent_product_name"
+ t.string "irproduct_other"
t.string "purchaser_code"
t.integer "reason"
t.string "propcode"
@@ -141,16 +139,8 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do
t.string "prevloc"
t.integer "hb"
t.integer "hbrentshortfall"
- t.string "postcode"
- t.string "postcod2"
- t.string "ppostc1"
- t.string "ppostc2"
t.integer "property_relet"
t.datetime "mrcdate", precision: nil
- t.integer "mrcday"
- t.integer "mrcmonth"
- t.integer "mrcyear"
- t.integer "other_hhmemb"
t.integer "incref"
t.datetime "sale_completion_date", precision: nil
t.datetime "startdate", precision: nil
@@ -158,7 +148,7 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do
t.integer "first_time_property_let_as_social_housing"
t.integer "unitletas"
t.integer "builtype"
- t.datetime "property_void_date", precision: nil
+ t.datetime "voiddate", precision: nil
t.bigint "owning_organisation_id"
t.bigint "managing_organisation_id"
t.integer "renttype"
@@ -167,9 +157,6 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do
t.integer "postcode_known"
t.integer "la_known"
t.boolean "is_la_inferred"
- t.integer "day"
- t.integer "month"
- t.integer "year"
t.integer "totchild"
t.integer "totelder"
t.integer "totadult"
@@ -219,9 +206,6 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do
t.decimal "wtshortfall", precision: 10, scale: 2
t.integer "refused"
t.integer "housingneeds"
- t.integer "vday"
- t.integer "vmonth"
- t.integer "vyear"
t.decimal "wchchrg", precision: 10, scale: 2
t.integer "newprop"
t.string "relat2"
@@ -232,6 +216,9 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do
t.string "relat7"
t.string "relat8"
t.integer "rent_value_check"
+ t.integer "old_form_id"
+ t.integer "lar"
+ t.integer "irproduct"
t.index ["managing_organisation_id"], name: "index_case_logs_on_managing_organisation_id"
t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id"
end
@@ -318,6 +305,7 @@ ActiveRecord::Schema[7.0].define(version: 202202071123100) do
t.string "last_sign_in_ip"
t.integer "role"
t.string "old_user_id"
+ t.string "phone"
t.integer "failed_attempts", default: 0
t.string "unlock_token"
t.datetime "locked_at", precision: nil
diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json
index 742c2a571..dc709691b 100644
--- a/docs/api/DLUHC-CORE-Data.v1.json
+++ b/docs/api/DLUHC-CORE-Data.v1.json
@@ -361,7 +361,7 @@
"cap": 0,
"hbrentshortfall": 0,
"tshortfall": 12,
- "other_reason_for_leaving_last_settled_home": null,
+ "reasonother": null,
"housingneeds_a": 1,
"housingneeds_b": 0,
"housingneeds_c": 0,
@@ -940,4 +940,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/spec/components/document_list_component_spec.rb b/spec/components/document_list_component_spec.rb
new file mode 100644
index 000000000..ee0c32301
--- /dev/null
+++ b/spec/components/document_list_component_spec.rb
@@ -0,0 +1,19 @@
+require "rails_helper"
+
+RSpec.describe DocumentListComponent, type: :component do
+ let(:items) do
+ [{ name: "PDF Form", href: "/forms/form.pdf", description: "An important form", metadata: "4 pages" },
+ { name: "Website", href: "https://example.com" }]
+ end
+
+ context "when rendering tabs" do
+ it "all of the nav tabs specified in the items hash are passed to it" do
+ result = render_inline(described_class.new(items:))
+
+ expect(result.text).to include("PDF Form")
+ expect(result.text).to include("An important form")
+ expect(result.text).to include("4 pages")
+ expect(result.text).to include("Website")
+ end
+ end
+end
diff --git a/spec/components/primary_navigation_component_spec.rb b/spec/components/primary_navigation_component_spec.rb
new file mode 100644
index 000000000..c088df1e7
--- /dev/null
+++ b/spec/components/primary_navigation_component_spec.rb
@@ -0,0 +1,27 @@
+require "rails_helper"
+
+RSpec.describe PrimaryNavigationComponent, type: :component do
+ let(:items) do
+ [{ name: "Organisations", url: "#", current: true },
+ { name: "Users", url: "#" },
+ { name: "Logs ", url: "#" }]
+ end
+
+ context "when the item is 'current' in nav tabs" do
+ it "then that tab appears as selected" do
+ result = render_inline(described_class.new(items:))
+
+ expect(result.css('.app-primary-navigation__link[aria-current="page"]').text).to include("Organisations")
+ end
+ end
+
+ context "when rendering tabs" do
+ it "all of the nav tabs specified in the items hash are passed to it" do
+ result = render_inline(described_class.new(items:))
+
+ expect(result.text).to include("Organisations")
+ expect(result.text).to include("Users")
+ expect(result.text).to include("Logs")
+ end
+ end
+end
diff --git a/spec/components/tab_navigation_component_spec.rb b/spec/components/tab_navigation_component_spec.rb
deleted file mode 100644
index e160a3766..000000000
--- a/spec/components/tab_navigation_component_spec.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require "rails_helper"
-
-RSpec.describe TabNavigationComponent, type: :component do
- let(:items) do
- [{ name: "Application", url: "#", current: true },
- { name: "Notes", url: "#" },
- { name: "Timeline", url: "#" }]
- end
-
- context "when the item is 'current' in nav tabs" do
- it "then that tab appears as selected" do
- result = render_inline(described_class.new(items:))
-
- expect(result.css('.app-tab-navigation__link[aria-current="page"]').text).to include("Application")
- end
- end
-
- context "when rendering tabs" do
- it "all of the nav tabs specified in the items hash are passed to it" do
- result = render_inline(described_class.new(items:))
-
- expect(result.text).to include("Application")
- expect(result.text).to include("Notes")
- expect(result.text).to include("Timeline")
- end
- end
-end
diff --git a/spec/controllers/admin/admin_users_controller_spec.rb b/spec/controllers/admin/admin_users_controller_spec.rb
index 5d4c57944..f1f2ebeab 100644
--- a/spec/controllers/admin/admin_users_controller_spec.rb
+++ b/spec/controllers/admin/admin_users_controller_spec.rb
@@ -28,7 +28,7 @@ describe Admin::AdminUsersController, type: :controller do
let(:params) { { admin_user: { email: "test2@example.com", password: "pAssword1", phone: "07566126368" } } }
it "creates a new admin user" do
- expect { post :create, session: valid_session, params: params }.to change(AdminUser, :count).by(1)
+ expect { post :create, session: valid_session, params: }.to change(AdminUser, :count).by(1)
end
it "tracks who created the record" do
@@ -59,7 +59,7 @@ describe Admin::AdminUsersController, type: :controller do
let(:params) { { id: admin_user.id, admin_user: { email: } } }
before do
- patch :update, session: valid_session, params: params
+ patch :update, session: valid_session, params:
end
it "updates the user without needing to input a password" do
diff --git a/spec/controllers/admin/case_logs_controller_spec.rb b/spec/controllers/admin/case_logs_controller_spec.rb
index 35b5fafee..40ab44c4a 100644
--- a/spec/controllers/admin/case_logs_controller_spec.rb
+++ b/spec/controllers/admin/case_logs_controller_spec.rb
@@ -40,7 +40,7 @@ describe Admin::CaseLogsController, type: :controller do
end
it "creates a new case log" do
- expect { post :create, session: valid_session, params: params }.to change(CaseLog, :count).by(1)
+ expect { post :create, session: valid_session, params: }.to change(CaseLog, :count).by(1)
end
it "tracks who created the record" do
@@ -71,7 +71,7 @@ describe Admin::CaseLogsController, type: :controller do
let(:params) { { id: case_log.id, case_log: { tenant_code: } } }
before do
- patch :update, session: valid_session, params: params
+ patch :update, session: valid_session, params:
end
it "updates the case log" do
diff --git a/spec/controllers/admin/organisations_controller_spec.rb b/spec/controllers/admin/organisations_controller_spec.rb
index f639a3b7e..d66bc3c4c 100644
--- a/spec/controllers/admin/organisations_controller_spec.rb
+++ b/spec/controllers/admin/organisations_controller_spec.rb
@@ -29,7 +29,7 @@ describe Admin::OrganisationsController, type: :controller do
let(:params) { { organisation: { name: "DLUHC", provider_type: "LA" } } }
it "creates a organisation" do
- expect { post :create, session: valid_session, params: params }.to change(Organisation, :count).by(1)
+ expect { post :create, session: valid_session, params: }.to change(Organisation, :count).by(1)
end
it "tracks who created the record" do
@@ -59,7 +59,7 @@ describe Admin::OrganisationsController, type: :controller do
let(:params) { { id: organisation.id, organisation: { name: } } }
before do
- patch :update, session: valid_session, params: params
+ patch :update, session: valid_session, params:
end
it "updates the organisation" do
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb
index 7f32500a2..71e572493 100644
--- a/spec/controllers/admin/users_controller_spec.rb
+++ b/spec/controllers/admin/users_controller_spec.rb
@@ -40,7 +40,7 @@ describe Admin::UsersController, type: :controller do
end
it "creates a new user" do
- expect { post :create, session: valid_session, params: params }.to change(User, :count).by(1)
+ expect { post :create, session: valid_session, params: }.to change(User, :count).by(1)
end
it "tracks who created the record" do
@@ -73,7 +73,7 @@ describe Admin::UsersController, type: :controller do
let(:params) { { id: user.id, user: { name: } } }
before do
- patch :update, session: valid_session, params: params
+ patch :update, session: valid_session, params:
end
it "updates the user without needing to input a password" do
diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb
index 2bec19c48..ce2dfaf90 100644
--- a/spec/factories/case_log.rb
+++ b/spec/factories/case_log.rb
@@ -7,7 +7,6 @@ FactoryBot.define do
needstype { 1 }
rent_type { 1 }
startdate { Time.zone.local(2022, 5, 1) }
- year { 2022 }
end
trait :in_progress do
status { 1 }
@@ -21,7 +20,7 @@ FactoryBot.define do
status { 1 }
ecstat1 { 1 }
earnings { 750 }
- incfreq { 0 }
+ incfreq { 1 }
end
trait :conditional_section_complete do
tenant_code { "TH356" }
@@ -30,19 +29,17 @@ FactoryBot.define do
ethnic { 2 }
national { 4 }
ecstat1 { 2 }
- other_hhmemb { 0 }
+ hhmemb { 1 }
end
trait :completed do
status { 2 }
tenant_code { "BZ737" }
- postcode { "NW1 7TY" }
age1 { 35 }
sex1 { "F" }
ethnic { 2 }
national { 4 }
prevten { 6 }
ecstat1 { 0 }
- other_hhmemb { 1 }
hhmemb { 2 }
relat2 { "P" }
age2 { 32 }
@@ -52,25 +49,21 @@ FactoryBot.define do
underoccupation_benefitcap { 0 }
leftreg { 1 }
reservist { 0 }
- illness { 0 }
- preg_occ { 1 }
+ illness { 1 }
+ preg_occ { 2 }
tenancy_code { "BZ757" }
startertenancy { 0 }
tenancylength { 5 }
- tenancy { 3 }
- landlord { 1 }
+ tenancy { 1 }
ppostcode_full { "SE2 6RT" }
- rsnvac { 7 }
- unittype_gn { 2 }
+ rsnvac { 6 }
+ unittype_gn { 7 }
beds { 3 }
- property_void_date { "03/11/2019" }
- vday { 3 }
- vmonth { 11 }
- vyear { 2019 }
+ voiddate { "03/11/2019" }
offered { 2 }
wchair { 1 }
earnings { 68 }
- incfreq { 0 }
+ incfreq { 1 }
benefits { 1 }
period { 2 }
brent { 200 }
@@ -79,20 +72,19 @@ FactoryBot.define do
supcharg { 35 }
tcharge { 325 }
layear { 2 }
- lawaitlist { 1 }
+ waityear { 1 }
postcode_full { "NW1 5TY" }
reasonpref { 1 }
cbl { 1 }
chr { 1 }
cap { 0 }
- other_reason_for_leaving_last_settled_home { nil }
+ reasonother { nil }
housingneeds_a { 1 }
housingneeds_b { 0 }
housingneeds_c { 0 }
housingneeds_f { 0 }
housingneeds_g { 0 }
housingneeds_h { 0 }
- accessibility_requirements_prefer_not_to_say { 0 }
illness_type_1 { 0 }
illness_type_2 { 1 }
illness_type_3 { 0 }
@@ -115,7 +107,6 @@ FactoryBot.define do
property_manager_organisation { "Test" }
renewal { 0 }
rent_type { 1 }
- intermediate_rent_product_name { 2 }
needstype { 1 }
purchaser_code { 798_794 }
reason { 4 }
@@ -126,21 +117,12 @@ FactoryBot.define do
hb { 6 }
hbrentshortfall { 0 }
tshortfall { 12 }
- postcod2 { "w3" }
- ppostc1 { "w3" }
- ppostc2 { "w3" }
property_relet { 0 }
mrcdate { Time.utc(2020, 5, 0o5, 10, 36, 49) }
- mrcday { mrcdate.day }
- mrcmonth { mrcdate.month }
- mrcyear { mrcdate.year }
incref { 0 }
sale_completion_date { nil }
startdate { Time.utc(2022, 2, 2, 10, 36, 49) }
- day { startdate.day }
- month { startdate.month }
- year { startdate.year }
- armedforces { 0 }
+ armedforces { 1 }
builtype { 1 }
unitletas { 2 }
has_benefits { 1 }
diff --git a/spec/features/form/check_answers_page_spec.rb b/spec/features/form/check_answers_page_spec.rb
index 34125ee41..523e43038 100644
--- a/spec/features/form/check_answers_page_spec.rb
+++ b/spec/features/form/check_answers_page_spec.rb
@@ -53,7 +53,7 @@ RSpec.describe "Form Check Answers Page" do
it "has question headings based on the subsection" do
visit("/logs/#{id}/#{subsection}/check-answers")
- question_labels = ["Tenant code", "Lead tenant’s age", "Lead tenant’s gender identity", "Number of Other Household Members"]
+ question_labels = ["Tenant code", "Lead tenant’s age", "Lead tenant’s gender identity", "Number of Household Members"]
question_labels.each do |label|
expect(page).to have_content(label)
end
@@ -113,7 +113,7 @@ RSpec.describe "Form Check Answers Page" do
it "displays conditional question that were visited" do
visit("/logs/#{id}/conditional-question")
- choose("case-log-preg-occ-1-field", allow_label_click: true)
+ choose("case-log-preg-occ-2-field", allow_label_click: true)
click_button("Save and continue")
visit("/logs/#{id}/#{conditional_subsection}/check-answers")
question_labels = ["Has the condition been met?", "Has the condition not been met?"]
@@ -151,7 +151,7 @@ RSpec.describe "Form Check Answers Page" do
tenant_code: "123",
age1: 35,
sex1: "M",
- other_hhmemb: 0,
+ hhmemb: 1,
)
end
@@ -164,9 +164,9 @@ RSpec.describe "Form Check Answers Page" do
tenant_code: "123",
age1: 35,
sex1: "M",
- other_hhmemb: 0,
+ hhmemb: 1,
armedforces: 3,
- illness: 0,
+ illness: 1,
)
end
@@ -179,9 +179,9 @@ RSpec.describe "Form Check Answers Page" do
tenant_code: "123",
age1: 35,
sex1: "M",
- other_hhmemb: 0,
+ hhmemb: 1,
armedforces: 3,
- illness: 0,
+ illness: 1,
housingneeds_h: 1,
la: "E06000014",
illness_type_1: 1,
@@ -197,7 +197,7 @@ RSpec.describe "Form Check Answers Page" do
tenant_code: nil,
age1: nil,
layear: 2,
- lawaitlist: 1,
+ waityear: 1,
postcode_full: "NW1 5TY",
reason: 4,
ppostcode_full: "SE2 6RT",
diff --git a/spec/features/form/conditional_questions_spec.rb b/spec/features/form/conditional_questions_spec.rb
index db558c93a..9b5c01a20 100644
--- a/spec/features/form/conditional_questions_spec.rb
+++ b/spec/features/form/conditional_questions_spec.rb
@@ -27,11 +27,11 @@ RSpec.describe "Form Conditional Questions" do
it "shows conditional questions if the required answer is selected and hides it again when a different answer option is selected", js: true do
visit("/logs/#{id}/armed-forces")
# Something about our styling makes the selenium webdriver think the actual radio buttons are not visible so we allow label click here
- choose("case-log-armedforces-0-field", allow_label_click: true)
- fill_in("case-log-leftreg-field", with: "text")
choose("case-log-armedforces-1-field", allow_label_click: true)
+ fill_in("case-log-leftreg-field", with: "text")
+ choose("case-log-armedforces-4-field", allow_label_click: true)
expect(page).not_to have_field("case-log-leftreg-field")
- choose("case-log-armedforces-0-field", allow_label_click: true)
+ choose("case-log-armedforces-1-field", allow_label_click: true)
expect(page).to have_field("case-log-leftreg-field", with: "")
end
end
diff --git a/spec/features/form/form_navigation_spec.rb b/spec/features/form/form_navigation_spec.rb
index fd4f78b08..ef8bc7448 100644
--- a/spec/features/form/form_navigation_spec.rb
+++ b/spec/features/form/form_navigation_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe "Form Navigation" do
age1: { type: "numeric", answer: 25, path: "person-1-age" },
sex1: { type: "radio", answer: "Female", path: "person-1-gender" },
ecstat1: { type: "radio", answer: 3, path: "person-1-working-situation" },
- other_hhmemb: { type: "numeric", answer: 2, path: "household-number-of-other-members" },
+ hhmemb: { type: "numeric", answer: 1, path: "household-number-of-members" },
}
end
@@ -71,7 +71,7 @@ RSpec.describe "Form Navigation" do
visit("/logs")
visit("/logs/#{id}/net-income")
fill_in("case-log-earnings-field", with: 740)
- choose("case-log-incfreq-0-field", allow_label_click: true)
+ choose("case-log-incfreq-1-field", allow_label_click: true)
click_button("Save and continue")
click_link(text: "Back")
click_link(text: "Back")
diff --git a/spec/features/form/page_routing_spec.rb b/spec/features/form/page_routing_spec.rb
index d4f50f118..83a1078ff 100644
--- a/spec/features/form/page_routing_spec.rb
+++ b/spec/features/form/page_routing_spec.rb
@@ -24,12 +24,12 @@ RSpec.describe "Form Page Routing" do
visit("/logs/#{id}/conditional-question")
# using a question name that is already in the db to avoid
# having to add a new column to the db for this test
- choose("case-log-preg-occ-0-field", allow_label_click: true)
+ choose("case-log-preg-occ-1-field", allow_label_click: true)
click_button("Save and continue")
expect(page).to have_current_path("/logs/#{id}/conditional-question-yes-page")
click_link(text: "Back")
expect(page).to have_current_path("/logs/#{id}/conditional-question")
- choose("case-log-preg-occ-1-field", allow_label_click: true)
+ choose("case-log-preg-occ-2-field", allow_label_click: true)
click_button("Save and continue")
expect(page).to have_current_path("/logs/#{id}/conditional-question-no-page")
end
@@ -40,7 +40,7 @@ RSpec.describe "Form Page Routing" do
click_button("Save and continue")
expect(page).to have_current_path("/logs/#{id}/person-1-working-situation")
visit("/logs/#{id}/conditional-question")
- choose("case-log-preg-occ-1-field", allow_label_click: true)
+ choose("case-log-preg-occ-2-field", allow_label_click: true)
click_button("Save and continue")
expect(page).to have_current_path("/logs/#{id}/conditional-question-no-page")
click_button("Save and continue")
diff --git a/spec/features/form/saving_data_spec.rb b/spec/features/form/saving_data_spec.rb
index d9fa2feba..9e8d09f58 100644
--- a/spec/features/form/saving_data_spec.rb
+++ b/spec/features/form/saving_data_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe "Form Saving Data" do
tenant_code: { type: "text", answer: "BZ737", path: "tenant_code" },
age1: { type: "numeric", answer: 25, path: "person_1_age" },
sex1: { type: "radio", answer: { "F" => "Female" }, path: "person_1_gender" },
- other_hhmemb: { type: "numeric", answer: 2, path: "household_number_of_other_members" },
+ hhmemb: { type: "numeric", answer: 3, path: "household_number_of_members" },
}
end
diff --git a/spec/features/form/validations_spec.rb b/spec/features/form/validations_spec.rb
index b884264a4..75e7f3e99 100644
--- a/spec/features/form/validations_spec.rb
+++ b/spec/features/form/validations_spec.rb
@@ -127,7 +127,7 @@ RSpec.describe "validations" do
it "prompts the user to confirm the value is correct with an interruption screen" do
visit("/logs/#{case_log.id}/net-income")
fill_in("case-log-earnings-field", with: income_over_soft_limit)
- choose("case-log-incfreq-0-field", allow_label_click: true)
+ choose("case-log-incfreq-1-field", allow_label_click: true)
click_button("Save and continue")
expect(page).to have_current_path("/logs/#{case_log.id}/net-income-value-check")
expect(page).to have_content("Net income is outside the expected range based on the lead tenant’s working situation")
@@ -141,7 +141,7 @@ RSpec.describe "validations" do
it "returns the user to the previous question if they do not confirm the value as correct on the interruption screen" do
visit("/logs/#{case_log.id}/net-income")
fill_in("case-log-earnings-field", with: income_over_soft_limit)
- choose("case-log-incfreq-0-field", allow_label_click: true)
+ choose("case-log-incfreq-1-field", allow_label_click: true)
click_button("Save and continue")
choose("case-log-net-income-value-check-1-field", allow_label_click: true)
click_button("Save and continue")
diff --git a/spec/features/organisation_spec.rb b/spec/features/organisation_spec.rb
index 3fa703c79..ddf38c72e 100644
--- a/spec/features/organisation_spec.rb
+++ b/spec/features/organisation_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe "User Features" do
context "when viewing organisation page" do
it "defaults to organisation details" do
visit("/logs")
- click_link("Your organisation")
+ click_link("About your organisation")
expect(page).to have_content(user.organisation.name)
end
@@ -32,7 +32,7 @@ RSpec.describe "User Features" do
visit("/organisations/#{org_id}")
click_link("Users")
expect(page).to have_current_path("/organisations/#{org_id}/users")
- click_link("Details")
+ click_link("About your organisation")
expect(page).to have_current_path("/organisations/#{org_id}/details")
end
end
@@ -72,10 +72,11 @@ RSpec.describe "User Features" do
context "when viewing organisation page" do
it "can see the details tab and users tab" do
visit("/logs")
- click_link("Your organisation")
+ click_link("About your organisation")
expect(page).to have_current_path("/organisations/#{org_id}/details")
- expect(page).to have_link("Details")
+ expect(page).to have_link("Logs")
expect(page).to have_link("Users")
+ expect(page).to have_link("About your organisation")
end
end
end
diff --git a/spec/features/reset_password.html.erb b/spec/features/reset_password.html.erb
index e12a0beed..1bf271dab 100644
--- a/spec/features/reset_password.html.erb
+++ b/spec/features/reset_password.html.erb
@@ -2,7 +2,7 @@
<% content_for :before_content do %>
<%= govuk_back_link(
- text: 'Back',
+ text: "Back",
href: :back,
) %>
<% end %>
@@ -20,12 +20,10 @@
<%= f.govuk_password_field :password,
label: { text: "New password" },
hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil,
- autocomplete: "new-password"
- %>
+ autocomplete: "new-password" %>
<%= f.govuk_password_field :password_confirmation,
- label: { text: "Confirm new password" }
- %>
+ label: { text: "Confirm new password" } %>
<%= f.govuk_submit "Update" %>
diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json
index 9240f92de..d32fe927f 100644
--- a/spec/fixtures/complete_case_log.json
+++ b/spec/fixtures/complete_case_log.json
@@ -6,10 +6,9 @@
"ethnic": 0,
"national": 0,
"prevten": 6,
- "armedforces": 0,
+ "armedforces": 1,
"armed_forces_partner": "",
"ecstat1": 1,
- "other_hhmemb": 7,
"hhmemb": 8,
"relat2": "P",
"age2": 32,
@@ -43,39 +42,30 @@
"underoccupation_benefitcap": 0,
"leftreg": 1,
"reservist": 0,
- "illness": 0,
- "preg_occ": 0,
+ "illness": 1,
+ "preg_occ": 1,
"tenancy_code": "BZ757",
"startdate": "12/12/2021",
- "day": 12,
- "month": 12,
- "year": 2021,
"startertenancy": 0,
"tenancylength": 5,
- "tenancy": 3,
+ "tenancy": 1,
"landlord": 1,
"la": "Barnet",
"postcode_full": "NW1 5TY",
"property_relet": 0,
- "rsnvac": 0,
+ "rsnvac": 14,
"property_reference": "P9876",
- "unittype_gn": 2,
+ "unittype_gn": 7,
"property_building_type": "dummy",
"beds": 3,
- "property_void_date": "10/10/2020",
- "vday": 10,
- "vmonth": 10,
- "vyear": 2020,
+ "voiddate": "10/10/2020",
"majorrepairs": 1,
"mrcdate": "11/11/2020",
- "mrcday": 11,
- "mrcmonth": 11,
- "mrcyear": 2020,
"offered": 2,
"wchair": 1,
"net_income_known": 1,
"earnings": 150,
- "incfreq": 0,
+ "incfreq": 1,
"benefits": 1,
"hb": 1,
"period": 2,
@@ -95,7 +85,7 @@
"cap": 0,
"hbrentshortfall": 0,
"tshortfall": 12,
- "other_reason_for_leaving_last_settled_home": null,
+ "reasonother": null,
"housingneeds_a": 1,
"housingneeds_b": 0,
"housingneeds_c": 0,
@@ -131,8 +121,6 @@
"propcode": "123",
"postcode": "a1",
"postcod2": "w3",
- "ppostc1": "w3",
- "ppostc2": "w3",
"first_time_property_let_as_social_housing": 0,
"unitletas": 1,
"builtype": 0,
diff --git a/spec/fixtures/exports/case_logs.xml b/spec/fixtures/exports/case_logs.xml
index 6ad128d05..a5dd626af 100644
--- a/spec/fixtures/exports/case_logs.xml
+++ b/spec/fixtures/exports/case_logs.xml
@@ -38,38 +38,36 @@