Fill in the template with data from your housing management system. Your data should go below the headers, with one row per log. Leave column A blank - the bulk upload fields start in column B.
-
Make sure each column of your data aligns with the matching headers above. You may need to reorder your data.
-
Use the <%= govuk_link_to "Lettings bulk upload Specification (2024 to 2025)", @form.specification_path %> to check your data is in the correct format.
-
Username field: To assign a log to someone else, enter the email address they use to log into CORE.
-
If you have reordered the headers, keep the headers in the file.
-
+ <%= govuk_list [
+ "Fill in the template with data from your housing management system. Your data should go below the headers, with one row per log. Leave column A blank - the bulk upload fields start in column B.",
+ "Make sure each column of your data aligns with the matching headers above. You may need to reorder your data.",
+ "Use the #{govuk_link_to 'Lettings bulk upload Specification (2024 to 2025)', @form.specification_path} to check your data is in the correct format.".html_safe,
+ "Username field: To assign a log to someone else, enter the email address they use to log into CORE.".html_safe,
+ "If you have reordered the headers, keep the headers in the file.",
+ ], type: :bullet %>
<%= govuk_inset_text(text: "You can upload both general needs and supported housing logs in the same file for 2024 to 2025 data.") %>
Save your file
-
-
Save your file as a CSV.
-
Your file should now be ready to upload.
-
+ <%= govuk_list ["Save your file as a CSV.", "Your file should now be ready to upload."], type: :bullet %>
<%= f.govuk_submit class: "govuk-!-margin-top-7" %>
<% end %>
diff --git a/app/views/bulk_upload_lettings_resume/fix_choice.html.erb b/app/views/bulk_upload_lettings_resume/fix_choice.html.erb
index 383cdbfa1..225fb07bf 100644
--- a/app/views/bulk_upload_lettings_resume/fix_choice.html.erb
+++ b/app/views/bulk_upload_lettings_resume/fix_choice.html.erb
@@ -24,17 +24,9 @@
<%= govuk_details(summary_text: "How to choose between fixing errors on the CORE site or in the CSV") do %>
You may find it easier to fix the errors in the CSV file if:
-
-
you have a lot of errors
-
the CSV file is formatted incorrectly and you can see where the errors are
-
you need to fix multiple errors at once
-
+ <%= govuk_list ["you have a lot of errors", "the CSV file is formatted incorrectly and you can see where the errors are", "you need to fix multiple errors at once"], type: :bullet %>
You may find it easier to fix the errors on the CORE site if:
-
-
you need to see the data in context
-
you have a smaller file, with a few errors
-
you are not sure where the errors are
-
+ <%= govuk_list ["you need to see the data in context", "you have a smaller file, with a few errors", "you are not sure where the errors are"], type: :bullet %>
<% end %>
<%= f.govuk_collection_radio_buttons :choice,
diff --git a/app/views/bulk_upload_sales_logs/forms/prepare_your_file_2024.html.erb b/app/views/bulk_upload_sales_logs/forms/prepare_your_file_2024.html.erb
index 2a64de689..723ae5314 100644
--- a/app/views/bulk_upload_sales_logs/forms/prepare_your_file_2024.html.erb
+++ b/app/views/bulk_upload_sales_logs/forms/prepare_your_file_2024.html.erb
@@ -19,19 +19,16 @@
There are 8 rows of content in the templates. These rows are called the ‘headers’. They contain the CORE form questions and guidance about which questions are required and how to format your answers.
Create your file
-
-
Fill in the template with data from your housing management system. Your data should go below the headers, with one row per log. The bulk upload fields start at column B. Leave column A blank.
-
Make sure each column of your data aligns with the matching headers above. You may need to reorder your data.
-
Use the <%= govuk_link_to "Sales bulk upload Specification (2024 to 2025)", @form.specification_path %> to check your data is in the correct format.
-
Username field: To assign a log to someone else, enter the email address they use to log into CORE.
-
If you have reordered the headers, keep the headers in the file.
-
+ <%= govuk_list [
+ "Fill in the template with data from your housing management system. Your data should go below the headers, with one row per log. The bulk upload fields start at column B. Leave column A blank.",
+ "Make sure each column of your data aligns with the matching headers above. You may need to reorder your data.",
+ "Use the #{govuk_link_to 'Sales bulk upload Specification (2024 to 2025)', @form.specification_path} to check your data is in the correct format.".html_safe,
+ "Username field: To assign a log to someone else, enter the email address they use to log into CORE.".html_safe,
+ "If you have reordered the headers, keep the headers in the file.",
+ ], type: :bullet %>
Save your file
-
-
Save your file as a CSV.
-
Your file should now be ready to upload.
-
+ <%= govuk_list ["Save your file as a CSV.", "Your file should now be ready to upload."], type: :bullet %>
<%= f.govuk_submit %>
<% end %>
diff --git a/app/views/bulk_upload_sales_resume/fix_choice.html.erb b/app/views/bulk_upload_sales_resume/fix_choice.html.erb
index 946426d0c..b376ee62d 100644
--- a/app/views/bulk_upload_sales_resume/fix_choice.html.erb
+++ b/app/views/bulk_upload_sales_resume/fix_choice.html.erb
@@ -23,18 +23,10 @@
<%= govuk_details(summary_text: "How to choose between fixing errors on the CORE site or in the CSV") do %>
-
You may find it easier to fix the errors in the CSV file if:
-
-
you have a lot of errors
-
the CSV file is formatted incorrectly and you can see where the errors are
-
you need to fix multiple errors at once
-
+
You may find it easier to fix the errors in the CSV file if:
+ <%= govuk_list ["you have a lot of errors", "the CSV file is formatted incorrectly and you can see where the errors are", "you need to fix multiple errors at once"], type: :bullet %>
You may find it easier to fix the errors on the CORE site if:
-
-
you need to see the data in context
-
you have a smaller file, with a few errors
-
you are not sure where the errors are
-
+ <%= govuk_list ["you need to see the data in context", "you have a smaller file, with a few errors", "you are not sure where the errors are"], type: :bullet %>
<% end %>
<%= f.govuk_collection_radio_buttons :choice,
diff --git a/app/views/bulk_upload_shared/guidance.html.erb b/app/views/bulk_upload_shared/guidance.html.erb
index 4cb8b76b4..d3950fff7 100644
--- a/app/views/bulk_upload_shared/guidance.html.erb
+++ b/app/views/bulk_upload_shared/guidance.html.erb
@@ -34,12 +34,7 @@
The bulk upload templates contain 8 rows of ‘headers’ with information about how to fill in the template, including:
<% end %>
-
-
the CORE form questions and their field numbers
-
each field’s valid responses
-
if/when certain fields can be left blank
-
which fields are used to check for duplicate logs
-
+ <%= govuk_list ["the CORE form questions and their field numbers", "each field’s valid responses", "if/when certain fields can be left blank", "which fields are used to check for duplicate logs"], type: :bullet %>
You can paste your data below the headers or copy the headers and insert them above the data in your file. The bulk upload fields start at column B. Leave column A blank.
Make sure that each column of data aligns with the corresponding question in the headers. We recommend ordering your data to match the headers, but you can also reorder the headers to match your data. When processing the file, we check what each column of data represents based on the headers above.
Google is not allowed to use or share our analytics data with anyone.
Google Analytics stores anonymised information about:
-
-
how you got to the service
-
the pages you visit on the service and how long you spend on them
-
any errors you see while using the service
-
+ <%= govuk_list ["how you got to the service", "the pages you visit on the service and how long you spend on them", "any errors you see while using the service"], type: :bullet %>
Google Analytics cookies
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index d235491a1..c7d5e2230 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -103,7 +103,7 @@
<% feedback_link = govuk_link_to "giving us your feedback (opens in a new tab)", t("feedback_form"), rel: "noreferrer noopener", target: "_blank" %>
<%= govuk_phase_banner(
- classes: "govuk-width-container",
+ classes: "#{current_user.present? ? 'no-bottom-border ' : ''}govuk-width-container",
tag: govuk_phase_banner_tag(current_user),
text: "This is a new service – help us improve it by #{feedback_link}".html_safe,
) %>
diff --git a/app/views/logs/delete_duplicates.html.erb b/app/views/logs/delete_duplicates.html.erb
index 912b3491d..2c9acd523 100644
--- a/app/views/logs/delete_duplicates.html.erb
+++ b/app/views/logs/delete_duplicates.html.erb
@@ -15,15 +15,7 @@
<%= @duplicate_logs.count == 1 ? "This log" : "These logs" %> will be deleted:
<%= govuk_button_to @duplicate_logs.count == 1 ? "Delete this log" : "Delete these logs",
diff --git a/app/views/merge_requests/merge_request.html.erb b/app/views/merge_requests/merge_request.html.erb
index d8602b46c..ec3bcab02 100644
--- a/app/views/merge_requests/merge_request.html.erb
+++ b/app/views/merge_requests/merge_request.html.erb
@@ -14,13 +14,13 @@
Before you start
Regardless of the merge type, you’ll be asked for:
-
-
the organisations merging in CORE
-
the merge type: for example one organisation absorbing the rest, or them all creating a new organisation
-
to confirm or update the telephone number
-
the merge date
-
if user email addresses will change with this merge
-
+ <%= govuk_list [
+ "the organisations merging in CORE",
+ "the merge type: for example one organisation absorbing the rest, or them all creating a new organisation",
+ "to confirm or update the telephone number",
+ "the merge date",
+ "if user email addresses will change with this merge",
+ ], type: :bullet %>
If email addresses are changing
<%= govuk_inset_text(text: "Update all user email addresses on CORE as soon as they change, so that everyone can still access their CORE account. ") %>
@@ -30,14 +30,14 @@
If merging into a new organisation
You'll also be asked for the new organisation’s:
-
-
name
-
address
-
telephone number
-
housing provider type
-
Regulator of Social Housing registration number
-
held stock details
-
+ <%= govuk_list [
+ "name",
+ "address",
+ "telephone number",
+ "housing provider type",
+ "Regulator of Social Housing registration number",
+ "held stock details",
+ ], type: :bullet %>
<%= govuk_warning_text text: "You will not be able to submit your request without the above information. Do not start the form until you have obtained all of the information. " %>
diff --git a/app/views/organisation_relationships/add_managing_agent.html.erb b/app/views/organisation_relationships/add_managing_agent.html.erb
index 25c7c53a2..71e4b5abc 100644
--- a/app/views/organisation_relationships/add_managing_agent.html.erb
+++ b/app/views/organisation_relationships/add_managing_agent.html.erb
@@ -28,12 +28,10 @@
<%= govuk_button_link_to("Cancel", managing_agents_organisation_path(@organisation), secondary: true) %>
<%= govuk_details(summary_text: "Can't find the managing agent you're looking for?") do %>
-
-
Double check the spelling and try again
-
Type the first few letters to see the suggestions
-
If you still can't find it,
- <%= govuk_link_to("contact the MHCLG service desk", GlobalConstants::HELPDESK_URL, rel: "noreferrer noopener", target: "_blank") %>
-
-
+ <%= govuk_list [
+ "Double check the spelling and try again",
+ "Type the first few letters to see the suggestions",
+ "If you still can't find it, #{govuk_link_to('contact the MHCLG service desk', GlobalConstants::HELPDESK_URL, rel: 'noreferrer noopener', target: '_blank')}",
+ ], type: :bullet %>
<% end %>
<% end %>
diff --git a/app/views/organisation_relationships/add_stock_owner.html.erb b/app/views/organisation_relationships/add_stock_owner.html.erb
index 042442125..1bd522f54 100644
--- a/app/views/organisation_relationships/add_stock_owner.html.erb
+++ b/app/views/organisation_relationships/add_stock_owner.html.erb
@@ -28,12 +28,10 @@
<%= govuk_button_link_to("Cancel", stock_owners_organisation_path(@organisation), secondary: true) %>
<%= govuk_details(summary_text: "Can't find the stock owner you're looking for?") do %>
-
-
Double check the spelling and try again
-
Type the first few letters to see the suggestions
-
If you still can't find it,
- <%= govuk_link_to("contact the MHCLG service desk", GlobalConstants::HELPDESK_URL, rel: "noreferrer noopener", target: "_blank") %>
-
-
+ <%= govuk_list [
+ "Double check the spelling and try again",
+ "Type the first few letters to see the suggestions",
+ "If you still can't find it, #{govuk_link_to('contact the MHCLG service desk', GlobalConstants::HELPDESK_URL, rel: 'noreferrer noopener', target: '_blank')}",
+ ], type: :bullet %>
<% end %>
<% end %>
diff --git a/app/views/organisations/data_sharing_agreement.html.erb b/app/views/organisations/data_sharing_agreement.html.erb
index 722d9e176..54b6210c4 100644
--- a/app/views/organisations/data_sharing_agreement.html.erb
+++ b/app/views/organisations/data_sharing_agreement.html.erb
@@ -35,30 +35,26 @@
It is now agreed as follows:
2. Definitions and interpretation
2.1. In this Agreement the following words and phrases shall have the following meanings, unless expressly stated to the contrary:
-
-
“Act” means the Data Protection Act 2018;
-
“Authorised Representatives” means the nominated lead officer representing each of the
- parties with delegated authority to handle the day-to-day matters arising from this Agreement;
-
“Data Subject” means social housing lettings tenants and participants in discounted sales where their data is reported via the CORE system.
-
“Data Controller” has the meaning in Article 4(7) of the GDPR and section 5(2) of the Act.
-
“Data Processor” has the meaning in Article 4(8) of the GDPR.
-
“Data Protection Legislation” means the Data Protection Act 2018 and all applicable laws and regulations relating to the processing of personal data and privacy, including where applicable the guidance and codes of practice issued by the Information Commissioner; it includes the General Data Protection Regulation (GDPR).
-
“Data” means the data supplied by the CORE data providers via the CORE system and the data that is calculated or derived via the CORE system based on that initial data;
-
“GDPR” means the General Data Protection Regulation.
-
“Parties” means the parties to this Agreement, namely MHCLG and the CORE data providers. CORE data providers include social housing providers and managing organisations that provide data on behalf of the social housing providers.
-
“Personal Data” has the meaning in Article 4(1) of the GDPR. “Processing” has the meaning in Article 4(2) of the GDPR.
-
“Request for Information” means a request for information or a request under the Freedom of Information Act 2000.
-
“Special category personal data” has the meaning in Article 9(1) of the GDPR. In this Agreement:
-
-
A. The masculine includes the feminine and neuter;
-
B. Person means a natural person;
-
C. The singular includes the plural and vice versa;
-
D. A reference to any statute, enactment, order, regulation or other similar instrument
- shall be construed as a reference to the statute, enactment, order, regulation or instrument as amended by any subsequent statute, enactment, order, regulation or instrument or as contained in any subsequent re-enactment.
-
-
-
-
+ <%= govuk_list [
+ "“Act” means the Data Protection Act 2018;",
+ "“Authorised Representatives” means the nominated lead officer representing each of the parties with delegated authority to handle the day-to-day matters arising from this Agreement;",
+ "“Data Subject” means social housing lettings tenants and participants in discounted sales where their data is reported via the CORE system.",
+ "“Data Controller” has the meaning in Article 4(7) of the GDPR and section 5(2) of the Act.",
+ "“Data Processor” has the meaning in Article 4(8) of the GDPR.",
+ "“Data Protection Legislation” means the Data Protection Act 2018 and all applicable laws and regulations relating to the processing of personal data and privacy, including where applicable the guidance and codes of practice issued by the Information Commissioner; it includes the General Data Protection Regulation (GDPR).",
+ "“Data” means the data supplied by the CORE data providers via the CORE system and the data that is calculated or derived via the CORE system based on that initial data;",
+ "“GDPR” means the General Data Protection Regulation.",
+ "“Parties” means the parties to this Agreement, namely MHCLG and the CORE data providers. CORE data providers include social housing providers and managing organisations that provide data on behalf of the social housing providers.",
+ "“Personal Data” has the meaning in Article 4(1) of the GDPR. “Processing” has the meaning in Article 4(2) of the GDPR.",
+ "“Request for Information” means a request for information or a request under the Freedom of Information Act 2000.",
+ "“Special category personal data” has the meaning in Article 9(1) of the GDPR. In this Agreement:
+ #{ govuk_list([
+ 'A. The masculine includes the feminine and neuter;',
+ 'B. Person means a natural person;',
+ 'C. The singular includes the plural and vice versa;',
+ 'D. A reference to any statute, enactment, order, regulation or other similar instrument shall be construed as a reference to the statute, enactment, order, regulation or instrument as amended by any subsequent statute, enactment, order, regulation or instrument or as contained in any subsequent re-enactment.',
+ ], type: :bullet)}".html_safe,
+ ], type: :bullet %>
2.2. Headings are included in this Agreement for ease of reference only and shall not affect the interpretation or construction of this Agreement.
2.3. References in this Agreement to Clauses, Paragraphs and Annexes are, unless otherwise provided, references to the Clauses, Paragraphs and Annexes of this Agreement.
2.4. In the event and to the extent only of any conflict or inconsistency between the provisions of this Agreement and the provisions of any document referred to or referenced herein, the provisions of this Agreement shall prevail.
@@ -95,11 +91,13 @@
8.5. All work carried out by MHCLG will follow appropriate security measures and procedures to ensure the protection of the data.
9. Protection of personal data
9.1. CORE data providers and MHCLG agree that they shall:
-
-
A. Implement appropriate technical and organisational measures to protect the Personal Data against unauthorised or unlawful Processing and against accidental loss, destruction, damage, alteration or disclosure. These measures shall ensure a level of security appropriate to the harm which might result from any unauthorised or unlawful Processing, accidental loss, destruction or damage to the Personal Data and having regard to the nature of the Personal Data which is to be protected;
-
B. Take reasonable steps to ensure the reliability of any personnel who have access to the Personal Data. MHCLG and Data providers will ensure such personnel will be a limited number of analysts assigned to the data collection.
-
+ <%= govuk_list [
+ "A. Implement appropriate technical and organisational measures to protect the Personal Data against unauthorised or unlawful Processing and against accidental loss, destruction, damage, alteration or disclosure. These measures shall ensure a level of security appropriate to the harm which might result from any unauthorised or unlawful Processing, accidental loss, destruction or damage to the Personal Data and having regard to the nature of the Personal Data which is to be protected;",
+ "B. Take reasonable steps to ensure the reliability of any personnel who have access to the Personal Data. MHCLG and Data providers will ensure such personnel will be a limited number of analysts assigned to the data collection.",
+],
+ type: :bullet %>
+
9.2. The data providers and MHCLG shall comply at all times with the Data Protection Legislation and shall ensure that they each perform their obligations under this agreement in full compliance with the Data Protection Legislation and any other applicable law, in particular the Human Rights Act 1998 and the common law duty of confidentiality.
9.3. CORE data providers should limit access to CORE to a small number of individuals who can be named on request. CORE access is limited to registered users only via password, but it is the responsibility of the CORE data providers to ensure that all individuals granted access to the datasets should be briefed on the legal requirements around handling and storing the Data from CORE.
10. Freedom of information
@@ -128,15 +126,10 @@
16.1. The Parties shall comply with all relevant legislation, regulations, orders, statutory instruments and any amendments or re-enactments thereof from the commencement of this agreement.
As witness of which the parties have set their hands on the day and year first above written
signed for and on behalf of the Data Protection Officer for <%= org_name_for_data_sharing_agreement(@data_protection_confirmation, current_user) %>, by:
Since your organisation recently merged, we’ve reviewed your schemes for possible duplicates.
These sets of schemes and locations might be duplicates because they have the same answers for certain fields.
What you need to do
-
-
Review each set of schemes or locations and decide if they are duplicates.
-
If they are, choose one to keep and deactivate the others on the date your organisation merged.
-
When you have resolved all duplicates, confirm below.
-
+ <%= govuk_list [
+ "Review each set of schemes or locations and decide if they are duplicates.",
+ "If they are, choose one to keep and deactivate the others on the date your organisation merged.",
+ "When you have resolved all duplicates, confirm below.",
+ ], type: :bullet %>
If you need help with this, <%= govuk_link_to "contact the helpdesk (opens in a new tab)", GlobalConstants::HELPDESK_URL, target: "#" %>.
<% if @duplicate_schemes.any? %>
@@ -43,17 +43,17 @@
These schemes have the same answers for the following fields:
-
-
Type of scheme
-
Registered under Care Standards Act 2000
-
Housing stock owned by
-
Support services provided by
-
Primary client group
-
Has another client group
-
Secondary client group
-
Level of support given
-
Intended length of stay
-
+ <%= govuk_list [
+ "Type of scheme",
+ "Registered under Care Standards Act 2000",
+ "Housing stock owned by",
+ "Support services provided by",
+ "Primary client group",
+ "Has another client group",
+ "Secondary client group",
+ "Level of support given",
+ "Intended length of stay",
+ ], type: :bullet %>
<% end %>
The links below open in a new tab.
@@ -68,13 +68,7 @@
<% @duplicate_schemes.each do |duplicate_set| %>
<% body.with_row do |row| %>
<% row.with_cell do %>
-
- <% duplicate_set.each do |scheme| %>
-
We have restructured the way we group supported housing scheme data.
On old CORE, a scheme’s data was split into management group and scheme. On new CORE, the data is split into scheme and location.
These are the main changes:
-
-
Schemes now store data about the stock owner and support provider. This was previously stored in management group.
-
Schemes still store data about the type of support, as they did in old CORE.
-
Schemes no longer store data about postcodes where support is provided. These are now in locations.
-
+ <%= govuk_list [
+ "Schemes now store data about the stock owner and support provider. This was previously stored in management group.",
+ "Schemes still store data about the type of support, as they did in old CORE.",
+ "Schemes no longer store data about postcodes where support is provided. These are now in locations.",
+ ], type: :bullet %>
This new structure means data coordinators only needs to fill in support details once.
How schemes are migrated from old CORE
If your organisation has migrated from old CORE to new CORE, your existing schemes are on the <%= govuk_link_to("schemes page", schemes_path) %>, with the same details.
diff --git a/app/views/start/guidance.html.erb b/app/views/start/guidance.html.erb
index 6fbd157f0..367c6f05f 100644
--- a/app/views/start/guidance.html.erb
+++ b/app/views/start/guidance.html.erb
@@ -21,46 +21,50 @@
<%= accordion.with_section(heading_text: "Types of lettings you should create logs for") do %>
You’ll need to create a log for:
-
-
Tenants in general needs housing allocated a new letting. This includes tenants moving into the social rented sector from outside, existing social tenants moving between properties or landlords, and existing social tenants renewing lettings in the same property. If fixed-term and social or affordable rent, only include tenancies of 2 years or more.
-
Tenants in supported housing (social housing, sheltered accommodation and care homes) allocated a new letting. This includes tenants moving into the social rented sector from outside, existing social tenants moving between properties or landlords, and existing social tenants renewing lettings in the same property. All supported housing tenancies should be reported regardless of length.
-
Starter tenancies provided by local authorities (LAs) and lettings with an introductory period provided by private registered providers (PRPs) should be completed in CORE at the beginning of the starter or introductory period. The tenancy type and length entered should be based on the tenancy the tenant will roll onto once the starter or introductory period has been completed. You do not need to submit another CORE log once the period has been completed.
-
Room moves within a shared housing unit that result in a different property type or support needs – this is classed as an internal transfer of an existing social tenant to another property.
-
Existing tenants who are issued with a new tenancy agreement when stock is acquired, transferred or permanently decanted.
-
Tenants under the Rough Sleepers Initiative or Rough Sleeping Accommodation Programme, where accommodation is permanent.
-
Households previously provided with temporary accommodation to meet a duty under the homelessness legislation who are allocated a tenancy as a settled home ending the duty (this may be the same property).
-
Refugees and asylum seekers who have been granted indefinite leave to remain, humanitarian protection or exceptional leave to remain.
-
Affordable Rent lettings – where up to 80% of market rent can be charged and a new supply agreement is signed.
-
London Affordable Rent lettings – a type of Affordable Rent available in London through the Greater London Authority (GLA).
-
Intermediate Rent lettings – where the rent must not exceed 80% of the current market rate (including any service charges).
-
Rent to Buy lettings – where a discount of up to 20% market rent is charged for a single rental period for a minimum of 5 years. After that period, the tenant is offered the chance to purchase the property (either shared ownership or outright) at full market value.
-
London Living Rent lettings – a type of Intermediate Rent available in London through the Greater London Authority (GLA).
-
+ <%= govuk_list [
+ "Tenants in general needs housing allocated a new letting. This includes tenants moving into the social rented sector from outside, existing social tenants moving between properties or landlords, and existing social tenants renewing lettings in the same property. If fixed-term and social or affordable rent, only include tenancies of 2 years or more.",
+ "Tenants in supported housing (social housing, sheltered accommodation and care homes) allocated a new letting. This includes tenants moving into the social rented sector from outside, existing social tenants moving between properties or landlords, and existing social tenants renewing lettings in the same property. All supported housing tenancies should be reported regardless of length.",
+ "Starter tenancies provided by local authorities (LAs) and lettings with an introductory period provided by private registered providers (PRPs) should be completed in CORE at the beginning of the starter or introductory period. The tenancy type and length entered should be based on the tenancy the tenant will roll onto once the starter or introductory period has been completed. You do not need to submit another CORE log once the period has been completed.",
+ "Room moves within a shared housing unit that result in a different property type or support needs – this is classed as an internal transfer of an existing social tenant to another property.",
+ "Existing tenants who are issued with a new tenancy agreement when stock is acquired, transferred or permanently decanted.",
+ "Tenants under the Rough Sleepers Initiative or Rough Sleeping Accommodation Programme, where accommodation is permanent.",
+ "Households previously provided with temporary accommodation to meet a duty under the homelessness legislation who are allocated a tenancy as a settled home ending the duty (this may be the same property).",
+ "Refugees and asylum seekers who have been granted indefinite leave to remain, humanitarian protection or exceptional leave to remain.",
+ "Affordable Rent lettings – where up to 80% of market rent can be charged and a new supply agreement is signed.",
+ "London Affordable Rent lettings – a type of Affordable Rent available in London through the Greater London Authority (GLA).",
+ "Intermediate Rent lettings – where the rent must not exceed 80% of the current market rate (including any service charges).",
+ "Rent to Buy lettings – where a discount of up to 20% market rent is charged for a single rental period for a minimum of 5 years. After that period, the tenant is offered the chance to purchase the property (either shared ownership or outright) at full market value.",
+ "London Living Rent lettings – a type of Intermediate Rent available in London through the Greater London Authority (GLA).",
+ ],
+ type: :bullet %>
<% end %>
<%= accordion.with_section(heading_text: "Types of lettings you should not create logs for") do %>
You don’t need to create a log for:
-
-
Temporary general needs housing with a fixed period of less than 2 years if they are social or affordable rent. (Temporary lettings for intermediate rent and supported housing should be recorded).
-
Starter tenancies or lettings with an introductory period that roll onto or convert into the main tenancy. The CORE log should be completed at the beginning of this period.
-
Changes from sole to joint or joint to sole tenancies, where the number of people in the household has not changed.
-
Moves within a shared housing unit resulting in the same support needs or property type, even if a new tenancy or licence agreement is issued.
-
Lettings where no new tenancy agreement is signed.
-
Where stock is acquired, transferred or permanently decanted and the existing tenants are not issued with a new tenancy agreement.
-
Mutual exchanges including lettings where registered provider tenants have exchanged homes, for example through the national HOMESWAP system.
-
Successions and assignments.
-
Demotion of a secure or assured tenancy, and any subsequent conversion of the demoted tenancy to a secure or assured tenancy.
-
Lettings made to asylum seekers who are awaiting a decision on their applications for asylum under the Immigration and Asylum Act 1999.
-
Non-social lettings, including market-rented properties, employer-provided housing where the employer provides financial support, homes for staff of social landlords linked to employment, homes social landlords manage for organisations who are not social landlords, homes social landlords own but lease in entirety to organisations who are not social landlords, and freehold housing with variable charges for services and communal facilities.
-
+ <%= govuk_list [
+ "Temporary general needs housing with a fixed period of less than 2 years if they are social or affordable rent. (Temporary lettings for intermediate rent and supported housing should be recorded).",
+ "Starter tenancies or lettings with an introductory period that roll onto or convert into the main tenancy. The CORE log should be completed at the beginning of this period.",
+ "Changes from sole to joint or joint to sole tenancies, where the number of people in the household has not changed.",
+ "Moves within a shared housing unit resulting in the same support needs or property type, even if a new tenancy or licence agreement is issued.",
+ "Lettings where no new tenancy agreement is signed.",
+ "Where stock is acquired, transferred or permanently decanted and the existing tenants are not issued with a new tenancy agreement.",
+ "Mutual exchanges including lettings where registered provider tenants have exchanged homes, for example through the national HOMESWAP system.",
+ "Successions and assignments.",
+ "Demotion of a secure or assured tenancy, and any subsequent conversion of the demoted tenancy to a secure or assured tenancy.",
+ "Lettings made to asylum seekers who are awaiting a decision on their applications for asylum under the Immigration and Asylum Act 1999.",
+ "Non-social lettings, including market-rented properties, employer-provided housing where the employer provides financial support, homes for staff of social landlords linked to employment, homes social landlords manage for organisations who are not social landlords, homes social landlords own but lease in entirety to organisations who are not social landlords, and freehold housing with variable charges for services and communal facilities.",
+ ],
+ type: :bullet %>
<% end %>
<%= accordion.with_section(heading_text: "What if someone is reluctant to answer any questions?") do %>
If a tenant or buyer is reluctant to answer questions as part of a log, you should explain that:
-
-
all information they provide is anonymous and will not affect their housing, benefits or other services they receive.
-
the data they provide is vital in helping to build a complete picture of social housing in England and is used to inform social housing policy.
-
+ <%= govuk_list [
+ "all information they provide is anonymous and will not affect their housing, benefits or other services they receive.",
+ "the data they provide is vital in helping to build a complete picture of social housing in England and is used to inform social housing policy.",
+ ],
+ type: :bullet %>
+
If a tenant or buyer is still unwilling or unable to answer questions, select the ‘Don’t know’ or ‘Tenant/person prefers not to say’ options.
<% end %>
<% end %>
diff --git a/package.json b/package.json
index ef37dc8aa..32063907c 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
"css-loader": "^6.7.1",
"custom-event-polyfill": "^1.0.7",
"file-loader": "^6.2.0",
- "govuk-frontend": "5.1.0",
+ "govuk-frontend": "5.7.1",
"html5shiv": "^3.7.3",
"intersection-observer": "^0.12.0",
"mini-css-extract-plugin": "^2.6.0",
diff --git a/spec/components/primary_navigation_component_spec.rb b/spec/components/primary_navigation_component_spec.rb
index f5f41bff0..aeefa6130 100644
--- a/spec/components/primary_navigation_component_spec.rb
+++ b/spec/components/primary_navigation_component_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe PrimaryNavigationComponent, type: :component do
it "then that item 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")
+ expect(result.css('.govuk-service-navigation__link[aria-current="page"]').text).to include("Organisations")
end
end
diff --git a/spec/requests/auth/passwords_controller_spec.rb b/spec/requests/auth/passwords_controller_spec.rb
index 7f9bdfa30..f35df1c5a 100644
--- a/spec/requests/auth/passwords_controller_spec.rb
+++ b/spec/requests/auth/passwords_controller_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe Auth::PasswordsController, type: :request do
put "/account/password", params: update_password_params
# Devise redirects once after re-sign in with new password and then root redirects as well.
follow_redirect!
- expect(page).to have_css("div", class: "govuk-notification-banner__heading", text: message)
+ expect(page).to have_css("p", class: "govuk-notification-banner__heading", text: message)
end
end
end
diff --git a/spec/requests/organisation_relationships_controller_spec.rb b/spec/requests/organisation_relationships_controller_spec.rb
index 8733fba4b..1b1b3169e 100644
--- a/spec/requests/organisation_relationships_controller_spec.rb
+++ b/spec/requests/organisation_relationships_controller_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
end
it "shows the tab navigation" do
- expected_html = "
diff --git a/bin/rubocop b/bin/rubocop
new file mode 100755
index 000000000..40330c0ff
--- /dev/null
+++ b/bin/rubocop
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+# explicit rubocop config increases performance slightly while avoiding config confusion.
+ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
+
+load Gem.bin_path("rubocop", "rubocop")
diff --git a/bin/setup b/bin/setup
index ec47b79b3..92bd38ead 100755
--- a/bin/setup
+++ b/bin/setup
@@ -1,11 +1,10 @@
#!/usr/bin/env ruby
require "fileutils"
-# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
- system(*args) || abort("\n== Command #{args} failed ==")
+ system(*args, exception: true)
end
FileUtils.chdir APP_ROOT do
diff --git a/config/application.rb b/config/application.rb
index 2cda05fea..cb8979a78 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -12,7 +12,6 @@ require "action_mailbox/engine"
# require "action_text/engine"
require "action_view/railtie"
# require "action_cable/engine"
-# require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
@@ -22,8 +21,16 @@ Bundler.require(*Rails.groups)
module DataCollector
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
- config.load_defaults 7.0
+ config.load_defaults 7.2
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
+ config.autoload_lib(ignore: %w[assets tasks])
+
+ # it's strongly discouraged using add_autoload_paths_to_load_path, but rack_attack initializer can't load config files without it
+ config.add_autoload_paths_to_load_path = true
+
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
@@ -32,6 +39,8 @@ module DataCollector
config.time_zone = "London"
# config.eager_load_paths << Rails.root.join("extras")
+ # Don't generate system test files.
+ config.generators.system_tests = nil
config.exceptions_app = routes
config.active_job.queue_adapter = :sidekiq
diff --git a/config/environments/development.rb b/config/environments/development.rb
index f75643524..286c9ca30 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -6,7 +6,7 @@ Rails.application.configure do
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
- config.cache_classes = false
+ config.enable_reloading = true
# Do not eager load code on boot.
config.eager_load = false
@@ -14,7 +14,7 @@ Rails.application.configure do
# Show full error reports.
config.consider_all_requests_local = true
- # Enable server timing
+ # Enable server timing.
config.server_timing = true
# Enable/disable caching. By default caching is disabled.
@@ -24,9 +24,7 @@ Rails.application.configure do
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
- config.public_file_server.headers = {
- "Cache-Control" => "public, max-age=#{2.days.to_i}",
- }
+ config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
else
config.action_controller.perform_caching = false
@@ -39,6 +37,8 @@ Rails.application.configure do
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
+ # Disable caching for Action Mailer templates even if Action Controller
+ # caching is enabled.
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
@@ -72,15 +72,20 @@ Rails.application.configure do
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
+ # Highlight code that enqueued background job in logs.
+ config.active_job.verbose_enqueue_logs = true
+
# Raises error for missing translations.
config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
- # Uncomment if you wish to allow Action Cable access from any origin.
- # config.action_cable.disable_request_forgery_protection = true
+ # Raise error when a before_action's only/except options reference missing actions.
+ # config.action_controller.raise_on_missing_callback_actions = true
+ # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
+ # config.generators.apply_rubocop_autocorrect_after_generate!
Faker::Config.locale = "en-GB"
# see https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 55f442b3d..c337be49b 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -4,7 +4,7 @@ Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
- config.cache_classes = true
+ config.enable_reloading = false
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
@@ -13,15 +13,14 @@ Rails.application.configure do
config.eager_load = true
# Full error reports are disabled and caching is turned on.
- config.consider_all_requests_local = false
+ config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
- # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
- # Disable serving static files from the `/public` folder by default since
- # Apache or NGINX already handles this.
+ # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
@@ -34,28 +33,38 @@ Rails.application.configure do
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
- # Mount Action Cable outside main process or domain.
- # config.action_cable.mount_path = nil
- # config.action_cable.url = "wss://example.com/cable"
- # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
+ # config.assume_ssl = true
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
- # config.force_ssl = true
+ config.force_ssl = true
- # Include generic and useful information about system operation, but avoid logging too much
- # information to avoid inadvertent exposure of personally identifiable information (PII).
- config.log_level = :info
+ # Skip http-to-https redirect for the default health check endpoint.
+ # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
+
+ # Log to STDOUT by default
+ config.logger = ActiveSupport::Logger.new($stdout)
+ .tap { |logger| logger.formatter = ::Logger::Formatter.new }
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
+ # "info" includes generic and useful information about system operation, but avoids logging too much
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
+ # want to log everything, set the level to "debug".
+ config.log_level = :info
+
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
- # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "data_collector_production"
+ # Disable caching for Action Mailer templates even if Action Controller
+ # caching is enabled.
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: ENV["APP_HOST"] }
@@ -98,37 +107,16 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
- # Inserts middleware to perform automatic connection switching.
- # The `database_selector` hash is used to pass options to the DatabaseSelector
- # middleware. The `delay` is used to determine how long to wait after a write
- # to send a subsequent read to the primary.
- #
- # The `database_resolver` class is used by the middleware to determine which
- # database is appropriate to use based on the time delay.
- #
- # The `database_resolver_context` class is used by the middleware to set
- # timestamps for the last write to the primary. The resolver uses the context
- # class timestamps to determine how long to wait before reading from the
- # replica.
- #
- # By default Rails will store a last write timestamp in the session. The
- # DatabaseSelector middleware is designed as such you can define your own
- # strategy for connection switching and pass that into the middleware through
- # these configuration options.
- # config.active_record.database_selector = { delay: 2.seconds }
- # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
- # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
-
- # Inserts middleware to perform automatic shard swapping. The `shard_selector` hash
- # can be used to pass options to the `ShardSelector` middleware. The `lock` option is
- # used to determine whether shard swapping should be prohibited for the request.
- #
- # The `shard_resolver` option is used by the middleware to determine which shard
- # to switch to. The application must provide a mechanism for finding the shard name
- # in a proc. See guides for an example.
- # config.active_record.shard_selector = { lock: true }
- # config.active_record.shard_resolver = ->(request) { Tenant.find_by!(host: request.host).shard }
+ # Only use :id for inspections in production.
+ config.active_record.attributes_for_inspect = [:id]
+ # Enable DNS rebinding protection and other `Host` header attacks.
+ # config.hosts = [
+ # "example.com", # Allow requests from example.com
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
+ # ]
+ # Skip DNS rebinding protection for the default health check endpoint.
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
# see https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
config.active_record.yaml_column_permitted_classes = [Time, BigDecimal]
diff --git a/config/environments/test.rb b/config/environments/test.rb
index aa3fe7bba..0d6b14147 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,5 +1,4 @@
require "active_support/core_ext/integer/time"
-require "faker"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
@@ -9,26 +8,25 @@ require "faker"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
- # Turn false under Spring and add config.action_view.cache_template_loading = true
- config.cache_classes = true
+ # While tests run files are not watched, reloading is not necessary.
+ config.enable_reloading = false
- # Eager loading loads your whole application. When running a single test locally,
- # this probably isn't necessary. It's a good idea to do in a continuous integration
- # system, or in some way before deploying your code.
+ # Eager loading loads your entire application. When running a single test locally,
+ # this is usually not necessary, and can slow down your test suite. However, it's
+ # recommended that you enable it in continuous integration systems to ensure eager
+ # loading is working properly before deploying your code.
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
- config.public_file_server.headers = {
- "Cache-Control" => "public, max-age=#{1.hour.to_i}",
- }
+ config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
# Show full error reports and disable caching.
- config.consider_all_requests_local = true
+ config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store
- # Raise exceptions instead of rendering exception templates.
+ # Render exception templates for rescuable exceptions and raise for other exceptions.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
@@ -37,16 +35,20 @@ Rails.application.configure do
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
+ # Disable caching for Action Mailer templates even if Action Controller
+ # caching is enabled.
config.action_mailer.perform_caching = false
- config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
- config.action_mailer.default_options = { from: "test@gmail.com" }
-
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
+ # Unlike controllers, the mailer instance doesn't have any context about the
+ # incoming request so you'll need to provide the :host parameter yourself.
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
+ config.action_mailer.default_options = { from: "test@gmail.com" }
+
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
@@ -61,6 +63,10 @@ Rails.application.configure do
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Raise error when a before_action's only/except options reference missing actions.
+ # config.action_controller.raise_on_missing_callback_actions = true
+
Faker::Config.locale = "en-GB"
# see https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index e4e6a0e6c..ece129f2b 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -1 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = "1.0"
+
+# Add additional assets to the asset load path.
Rails.application.config.assets.paths << Rails.root.join("node_modules/@fortawesome/fontawesome-free/webfonts")
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
index 3621f97f8..b3076b38f 100644
--- a/config/initializers/content_security_policy.rb
+++ b/config/initializers/content_security_policy.rb
@@ -1,8 +1,8 @@
# Be sure to restart your server when you modify this file.
-# Define an application-wide content security policy
-# For further information see the following documentation
-# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
+# Define an application-wide content security policy.
+# See the Securing Rails Applications Guide for more information:
+# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security_policy do |policy|
@@ -16,11 +16,10 @@
# # policy.report_uri "/csp-violation-report-endpoint"
# end
#
-# # Generate session nonces for permitted importmap and inline scripts
+# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
-# config.content_security_policy_nonce_directives = %w(script-src)
+# config.content_security_policy_nonce_directives = %w(script-src style-src)
#
-# # Report CSP violations to a specified URI. See:
-# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
+# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true
# end
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
index 928c8f671..86f38ad46 100644
--- a/config/initializers/filter_parameter_logging.rb
+++ b/config/initializers/filter_parameter_logging.rb
@@ -1,6 +1,8 @@
# Be sure to restart your server when you modify this file.
-# Configure sensitive parameters which will be filtered from the log file.
+# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
+# Use this to limit dissemination of sensitive information.
+# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += %i[
- passw secret token crypt salt certificate otp ssn reset_password_token
+ passw secret email secret token _key crypt salt certificate otp ssn reset_password_token
]
diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb
index 00f64d71b..7db3b9577 100644
--- a/config/initializers/permissions_policy.rb
+++ b/config/initializers/permissions_policy.rb
@@ -1,11 +1,13 @@
+# Be sure to restart your server when you modify this file.
+
# Define an application-wide HTTP permissions policy. For further
-# information see https://developers.google.com/web/updates/2018/06/feature-policy
-#
-# Rails.application.config.permissions_policy do |f|
-# f.camera :none
-# f.gyroscope :none
-# f.microphone :none
-# f.usb :none
-# f.fullscreen :self
-# f.payment :self, "https://secure.example.com"
+# information see: https://developers.google.com/web/updates/2018/06/feature-policy
+
+# Rails.application.config.permissions_policy do |policy|
+# policy.camera :none
+# policy.gyroscope :none
+# policy.microphone :none
+# policy.usb :none
+# policy.fullscreen :self
+# policy.payment :self, "https://secure.example.com"
# end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 965c1f7a6..7a95aa6fd 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -382,6 +382,10 @@ en:
organisation_part_of_another_merge: "This organisation is part of another merge - select a different one."
organisation_part_of_another_incomplete_merge: "Another merge request records %{organisation} as merging into %{absorbing_organisation} on %{merge_date}. Select another organisation or remove this organisation from the other merge request."
organisation_not_selected: "Select an organisation from the search list."
+ merge_request_id:
+ blank: "Select a merge request."
+ merging_organisation_id:
+ blank: "Select an organisation to merge."
soft_validations:
retirement:
diff --git a/config/locales/test.en.yml b/config/locales/test.en.yml
new file mode 100644
index 000000000..ca1a93282
--- /dev/null
+++ b/config/locales/test.en.yml
@@ -0,0 +1,17 @@
+en:
+ forms:
+ 2021:
+ lettings:
+ guidance:
+ what_counts_as_income:
+ title: "What counts as income?"
+ content: "What counts as income?"
+ finding_scheme:
+ title: "Can’t find your scheme?"
+ content: "
Schemes are attached to the organisation that owns the property. Check you have correctly answered question 1 \"Which organisation owns this property?\"
+
If your organisation’s schemes were migrated from old CORE, they may have new names and codes. Search by postcode to find your scheme.
"
+ scheme_changes_link_text: "Read more about how schemes have changed"
+ view_schemes_link_text: "View your organisation’s schemes"
+ soft_validations:
+ net_income:
+ hint_text: "hint text"
diff --git a/config/puma.rb b/config/puma.rb
index d9b3e836c..5d0898ea5 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -1,9 +1,25 @@
-# Puma can serve each request in a thread from an internal thread pool.
-# The `threads` method setting takes two numbers: a minimum and maximum.
-# Any libraries that use thread pools should be configured to match
-# the maximum value specified for Puma. Default is set to 5 threads for minimum
-# and maximum; this matches the default thread size of Active Record.
+# This configuration file will be evaluated by Puma. The top-level methods that
+# are invoked here are part of Puma's configuration DSL. For more information
+# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
+
+# Puma starts a configurable number of processes (workers) and each process
+# serves each request in a thread from an internal thread pool.
+#
+# The ideal number of threads per worker depends both on how much time the
+# application spends waiting for IO operations and on how much you wish to
+# to prioritize throughput over latency.
+#
+# As a rule of thumb, increasing the number of threads will increase how much
+# traffic a given process can handle (throughput), but due to CRuby's
+# Global VM Lock (GVL) it has diminishing returns and will degrade the
+# response time (latency) of the application.
#
+# The default is set to 3 threads as it's deemed a decent compromise between
+# throughput and latency for the average Rails application.
+#
+# Any libraries that use a connection pool or another resource pool should
+# be configured to provide at least as many connections as the number of
+# threads. This includes Active Record's `pool` parameter in `database.yml`.
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
@@ -14,30 +30,16 @@ threads min_threads_count, max_threads_count
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
-#
+#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
-# Specifies the `pidfile` that Puma will use.
+# Specify the PID file. Defaults to tmp/pids/server.pid in development.
+# In other environments, only set the PID file if requested.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
-# Specifies the number of `workers` to boot in clustered mode.
-# Workers are forked web server processes. If using threads and workers together
-# the concurrency of the application would be max `threads` * `workers`.
-# Workers do not work on JRuby or Windows (both of which do not support
-# processes).
-#
-# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
-
-# Use the `preload_app!` method when specifying a `workers` number.
-# This directive tells Puma to first boot the application and load code
-# before forking the application. This takes advantage of Copy On Write
-# process behavior so workers use less memory.
-#
-# preload_app!
-
-# Allow puma to be restarted by `rails restart` command.
+# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart
diff --git a/db/migrate/20241206142942_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20241206142942_add_service_name_to_active_storage_blobs.active_storage.rb
new file mode 100644
index 000000000..0a13344fc
--- /dev/null
+++ b/db/migrate/20241206142942_add_service_name_to_active_storage_blobs.active_storage.rb
@@ -0,0 +1,22 @@
+# This migration comes from active_storage (originally 20190112182829)
+class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
+ def up
+ return unless table_exists?(:active_storage_blobs)
+
+ unless column_exists?(:active_storage_blobs, :service_name)
+ add_column :active_storage_blobs, :service_name, :string
+
+ if configured_service = ActiveStorage::Blob.service.name # rubocop:disable Lint/AssignmentInCondition
+ ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
+ end
+
+ change_column :active_storage_blobs, :service_name, :string, null: false
+ end
+ end
+
+ def down
+ return unless table_exists?(:active_storage_blobs)
+
+ remove_column :active_storage_blobs, :service_name
+ end
+end
diff --git a/db/migrate/20241206142943_create_active_storage_variant_records.active_storage.rb b/db/migrate/20241206142943_create_active_storage_variant_records.active_storage.rb
new file mode 100644
index 000000000..78b8564cf
--- /dev/null
+++ b/db/migrate/20241206142943_create_active_storage_variant_records.active_storage.rb
@@ -0,0 +1,28 @@
+# This migration comes from active_storage (originally 20191206030411)
+class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
+ def change
+ return unless table_exists?(:active_storage_blobs)
+
+ # Use Active Record's configured type for primary key
+ create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t| # rubocop:disable Rails/CreateTableWithTimestamps
+ t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
+ t.string :variation_digest, null: false
+
+ t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+ end
+
+private
+
+ def primary_key_type
+ config = Rails.configuration.generators
+ config.options[config.orm][:primary_key_type] || :primary_key
+ end
+
+ def blobs_primary_key_type
+ pkey_name = connection.primary_key(:active_storage_blobs)
+ pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
+ pkey_column.bigint? ? :bigint : pkey_column.type
+ end
+end
diff --git a/db/migrate/20241206142944_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20241206142944_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb
new file mode 100644
index 000000000..93c8b85ad
--- /dev/null
+++ b/db/migrate/20241206142944_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb
@@ -0,0 +1,8 @@
+# This migration comes from active_storage (originally 20211119233751)
+class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
+ def change
+ return unless table_exists?(:active_storage_blobs)
+
+ change_column_null(:active_storage_blobs, :checksum, true)
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 1a1c127c6..bd7672c24 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: 2024_12_04_100518) do
+ActiveRecord::Schema[7.2].define(version: 2024_12_06_142944) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
diff --git a/db/seeds.rb b/db/seeds.rb
index 2f018be91..f3dcb688d 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -12,13 +12,13 @@ def find_or_create_user(organisation, email, name, role)
end
end
-unless Rails.env.test?
- if LocalAuthority.count.zero?
- la_path = "config/local_authorities_data/initial_local_authorities.csv"
- service = Imports::LocalAuthoritiesService.new(path: la_path)
- service.call
- end
+if LocalAuthority.count.zero?
+ la_path = "config/local_authorities_data/initial_local_authorities.csv"
+ service = Imports::LocalAuthoritiesService.new(path: la_path)
+ service.call
+end
+unless Rails.env.test?
if LaRentRange.count.zero?
Dir.glob("config/rent_range_data/*.csv").each do |path|
start_year = File.basename(path, ".csv")
diff --git a/package.json b/package.json
index 32063907c..c5734b348 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"html5shiv": "^3.7.3",
"intersection-observer": "^0.12.0",
"mini-css-extract-plugin": "^2.6.0",
- "rails_admin": "3.1.3",
+ "rails_admin": "3.3.0",
"regenerator-runtime": "^0.13.9",
"sass": "^1.49.9",
"sass-loader": "^12.6.0",
diff --git a/spec/controllers/errors_controller_spec.rb b/spec/controllers/errors_controller_spec.rb
index d8ae16165..30361ea42 100644
--- a/spec/controllers/errors_controller_spec.rb
+++ b/spec/controllers/errors_controller_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe ErrorsController, type: :controller do
describe "GET #unprocessable_entity" do
it "returns unprocessable_entity" do
get :unprocessable_entity
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
end
end
end
diff --git a/spec/features/organisation_spec.rb b/spec/features/organisation_spec.rb
index 6f90428be..15bfecf39 100644
--- a/spec/features/organisation_spec.rb
+++ b/spec/features/organisation_spec.rb
@@ -206,14 +206,14 @@ RSpec.describe "User Features" do
it "can filter lettings logs by year" do
check("years-2022-field")
click_button("Apply filters")
- expect(page).to have_current_path("/organisations/#{org_id}/lettings-logs?years[]=&years[]=2022&status[]=&needstypes[]=&assigned_to=all&user_text_search=&user=&owning_organisation_select=all&owning_organisation_text_search=&owning_organisation=&managing_organisation_select=all&managing_organisation_text_search=&managing_organisation=")
+ expect(page).to have_current_path("/organisations/#{org_id}/lettings-logs?%5Byears%5D[]=&years[]=2022&%5Bstatus%5D[]=&%5Bneedstypes%5D[]=&assigned_to=all&user_text_search=&user=&owning_organisation_select=all&owning_organisation_text_search=&owning_organisation=&managing_organisation_select=all&managing_organisation_text_search=&managing_organisation=")
expect(page).not_to have_link first_log.id.to_s, href: "/lettings-logs/#{first_log.id}"
end
it "can filter lettings logs by needstype" do
check("needstypes-1-field")
click_button("Apply filters")
- expect(page).to have_current_path("/organisations/#{org_id}/lettings-logs?years[]=&status[]=&needstypes[]=&needstypes[]=1&assigned_to=all&user_text_search=&user=&owning_organisation_select=all&owning_organisation_text_search=&owning_organisation=&managing_organisation_select=all&managing_organisation_text_search=&managing_organisation=")
+ expect(page).to have_current_path("/organisations/#{org_id}/lettings-logs?%5Byears%5D[]=&%5Bstatus%5D[]=&%5Bneedstypes%5D[]=&needstypes[]=1&assigned_to=all&user_text_search=&user=&owning_organisation_select=all&owning_organisation_text_search=&owning_organisation=&managing_organisation_select=all&managing_organisation_text_search=&managing_organisation=")
other_general_needs_logs.each do |general_needs_log|
expect(page).to have_link general_needs_log.id.to_s, href: "/lettings-logs/#{general_needs_log.id}"
end
@@ -256,7 +256,7 @@ RSpec.describe "User Features" do
end
check("years-2022-field")
click_button("Apply filters")
- expect(page).to have_current_path("/organisations/#{org_id}/sales-logs?years[]=&years[]=2022&status[]=&assigned_to=all&user_text_search=&user=&owning_organisation_select=all&owning_organisation_text_search=&owning_organisation=&managing_organisation_select=all&managing_organisation_text_search=&managing_organisation=")
+ expect(page).to have_current_path("/organisations/#{org_id}/sales-logs?%5Byears%5D[]=&years[]=2022&%5Bstatus%5D[]=&assigned_to=all&user_text_search=&user=&owning_organisation_select=all&owning_organisation_text_search=&owning_organisation=&managing_organisation_select=all&managing_organisation_text_search=&managing_organisation=")
expect(page).not_to have_link first_log.id.to_s, href: "/sales-logs/#{first_log.id}"
end
end
diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb
index dfb56665b..84572f35b 100644
--- a/spec/features/schemes_spec.rb
+++ b/spec/features/schemes_spec.rb
@@ -87,7 +87,7 @@ RSpec.describe "Schemes scheme Features" do
it "displays the filters component with a correct count and clear button" do
expect(page).to have_content("2 filters applied")
- expect(page).to have_link("Clear", href: /clear-filters\?filter_type=schemes/)
+ expect(page).to have_link("Clear", href: /clear-filters\?.*filter_type=schemes/)
end
context "when clearing the filters" do
@@ -326,7 +326,7 @@ RSpec.describe "Schemes scheme Features" do
it "displays the filters component with a correct count and clear button" do
expect(page).to have_content("2 filters applied")
- expect(page).to have_link("Clear", href: /\/clear-filters\?filter_type=scheme_locations/)
+ expect(page).to have_link("Clear", href: /\/clear-filters\?.*filter_type=scheme_locations/)
end
context "when clearing the filters" do
diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb
index 2e837abe2..de3f2cbc5 100644
--- a/spec/features/user_spec.rb
+++ b/spec/features/user_spec.rb
@@ -269,7 +269,7 @@ RSpec.describe "User Features" do
it "displays the filters component with a correct count and clear button" do
expect(page).to have_content("2 filters applied")
- expect(page).to have_link("Clear", href: /clear-filters\?filter_type=users/)
+ expect(page).to have_link("Clear", href: /clear-filters\?.*filter_type=users/)
end
context "when clearing the filters" do
@@ -678,7 +678,7 @@ RSpec.describe "User Features" do
fill_in("code", with: otp)
click_button("Submit")
expect(page).to have_content("Check your email")
- expect(page).to have_http_status(:unprocessable_entity)
+ expect(page).to have_http_status(:unprocessable_content)
expect(page).to have_title("Error")
expect(page).to have_selector(".govuk-error-summary__title")
end
@@ -691,7 +691,7 @@ RSpec.describe "User Features" do
fill_in("code", with: otp)
click_button("Submit")
expect(page).to have_content("Check your email")
- expect(page).to have_http_status(:unprocessable_entity)
+ expect(page).to have_http_status(:unprocessable_content)
expect(page).to have_title("Error")
expect(page).to have_selector(".govuk-error-summary__title")
end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 5f7529554..c663087d5 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -51,7 +51,7 @@ rescue ActiveRecord::PendingMigrationError => e
end
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ config.fixture_paths = ["#{::Rails.root}/spec/fixtures"]
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
diff --git a/spec/requests/auth/passwords_controller_spec.rb b/spec/requests/auth/passwords_controller_spec.rb
index f35df1c5a..2685e19ab 100644
--- a/spec/requests/auth/passwords_controller_spec.rb
+++ b/spec/requests/auth/passwords_controller_spec.rb
@@ -107,7 +107,7 @@ RSpec.describe Auth::PasswordsController, type: :request do
it "shows an error on the same page" do
put "/account/password", headers: headers, params: params
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_css("h1", text: "Reset your password")
expect(page).to have_content("passwords you entered do not match")
end
diff --git a/spec/requests/delete_logs_controller_spec.rb b/spec/requests/delete_logs_controller_spec.rb
index cde0848f6..b055e9dd1 100644
--- a/spec/requests/delete_logs_controller_spec.rb
+++ b/spec/requests/delete_logs_controller_spec.rb
@@ -61,8 +61,9 @@ RSpec.describe "DeleteLogs", type: :request do
allow(FilterManager).to receive(:filter_logs).and_return LettingsLog.all
end
- it "throws an error if selected ids are not provided" do
- expect { post delete_logs_lettings_logs_path }.to raise_error ActionController::ParameterMissing
+ it "returns bad request if selected ids are not provided" do
+ post delete_logs_lettings_logs_path
+ expect(response).to have_http_status(:bad_request)
end
it "calls the filter service with the filters in the session and the search term from the query params" do
@@ -120,7 +121,8 @@ RSpec.describe "DeleteLogs", type: :request do
end
it "requires delete logs form data to be provided" do
- expect { post delete_logs_confirmation_lettings_logs_path }.to raise_error(ActionController::ParameterMissing)
+ post delete_logs_confirmation_lettings_logs_path
+ expect(response).to have_http_status(:bad_request)
end
it "shows the correct title" do
@@ -346,8 +348,9 @@ RSpec.describe "DeleteLogs", type: :request do
allow(FilterManager).to receive(:filter_logs).and_return SalesLog.all
end
- it "throws an error if selected ids are not provided" do
- expect { post delete_logs_sales_logs_path }.to raise_error ActionController::ParameterMissing
+ it "returns bad request if selected ids are not provided" do
+ post delete_logs_sales_logs_path
+ expect(response).to have_http_status(:bad_request)
end
it "calls the filter service with the filters in the session and the search term from the query params" do
@@ -405,7 +408,8 @@ RSpec.describe "DeleteLogs", type: :request do
end
it "requires delete logs form data to be provided" do
- expect { post delete_logs_confirmation_sales_logs_path }.to raise_error(ActionController::ParameterMissing)
+ post delete_logs_confirmation_sales_logs_path
+ expect(response).to have_http_status(:bad_request)
end
it "shows the correct title" do
@@ -635,8 +639,9 @@ RSpec.describe "DeleteLogs", type: :request do
allow(FilterManager).to receive(:filter_logs).and_return LettingsLog.all
end
- it "throws an error if selected ids are not provided" do
- expect { post delete_lettings_logs_organisation_path(id: organisation) }.to raise_error ActionController::ParameterMissing
+ it "returns bad request if selected ids are not provided" do
+ post delete_lettings_logs_organisation_path(id: organisation)
+ expect(response).to have_http_status(:bad_request)
end
it "calls the filter service with the filters in the session and the search term from the query params" do
@@ -694,7 +699,8 @@ RSpec.describe "DeleteLogs", type: :request do
end
it "requires delete logs form data to be provided" do
- expect { post delete_lettings_logs_confirmation_organisation_path(id: organisation) }.to raise_error(ActionController::ParameterMissing)
+ post delete_lettings_logs_confirmation_organisation_path(id: organisation)
+ expect(response).to have_http_status(:bad_request)
end
it "shows the correct title" do
@@ -858,8 +864,9 @@ RSpec.describe "DeleteLogs", type: :request do
allow(FilterManager).to receive(:filter_logs).and_return SalesLog.all
end
- it "throws an error if selected ids are not provided" do
- expect { post delete_sales_logs_organisation_path(id: organisation) }.to raise_error ActionController::ParameterMissing
+ it "returns bad request if selected ids are not provided" do
+ post delete_sales_logs_organisation_path(id: organisation)
+ expect(response).to have_http_status(:bad_request)
end
it "calls the filter service with the filters in the session and the search term from the query params" do
@@ -917,7 +924,8 @@ RSpec.describe "DeleteLogs", type: :request do
end
it "requires delete logs form data to be provided" do
- expect { post delete_sales_logs_confirmation_organisation_path(id: organisation) }.to raise_error(ActionController::ParameterMissing)
+ post delete_sales_logs_confirmation_organisation_path
+ expect(response).to have_http_status(:bad_request)
end
it "shows the correct title" do
diff --git a/spec/requests/form_controller_spec.rb b/spec/requests/form_controller_spec.rb
index 0cbec27d2..6ab49e302 100644
--- a/spec/requests/form_controller_spec.rb
+++ b/spec/requests/form_controller_spec.rb
@@ -1159,7 +1159,6 @@ RSpec.describe FormController, type: :request do
it "displays a success banner" do
follow_redirect!
- follow_redirect!
expect(response.body).to include("You have successfully updated Q31: lead tenant’s age")
end
@@ -1182,7 +1181,6 @@ RSpec.describe FormController, type: :request do
end
it "displays a success banner without crashing" do
- follow_redirect!
follow_redirect!
expect(response.body).to include("You have successfully updated")
end
diff --git a/spec/requests/lettings_logs_controller_spec.rb b/spec/requests/lettings_logs_controller_spec.rb
index b902305ad..14cd3095c 100644
--- a/spec/requests/lettings_logs_controller_spec.rb
+++ b/spec/requests/lettings_logs_controller_spec.rb
@@ -81,7 +81,7 @@ RSpec.describe LettingsLogsController, type: :request do
it "validates lettings log parameters" do
json_response = JSON.parse(response.body)
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(json_response["errors"]).to match_array([["offered", [I18n.t("validations.shared.numeric.within_range", field: "Times previously offered since becoming available", min: 0, max: 20)]], ["age1", [I18n.t("validations.shared.numeric.within_range", field: "Lead tenant’s age", min: 16, max: 120)]]])
end
end
@@ -1612,7 +1612,7 @@ RSpec.describe LettingsLogsController, type: :request do
let(:params) { { age1: 200 } }
it "returns 422" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
end
it "returns an error message" do
diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb
index 6de8e7d33..9afdc94f2 100644
--- a/spec/requests/locations_controller_spec.rb
+++ b/spec/requests/locations_controller_spec.rb
@@ -1192,7 +1192,7 @@ RSpec.describe LocationsController, type: :request do
end
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.startdate_invalid"))
end
end
@@ -1266,7 +1266,7 @@ RSpec.describe LocationsController, type: :request do
end
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.startdate_invalid"))
end
end
@@ -1702,7 +1702,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { "deactivation_date": "" } } }
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.not_selected"))
end
end
@@ -1711,7 +1711,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "10", "deactivation_date(2i)": "44", "deactivation_date(1i)": "2022" } } }
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.invalid"))
end
end
@@ -1720,7 +1720,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "10", "deactivation_date(2i)": "4", "deactivation_date(1i)": "2020" } } }
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.out_of_range", date: "1 April 2022"))
end
end
@@ -1729,7 +1729,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "", "deactivation_date(2i)": "2", "deactivation_date(1i)": "2022" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.invalid"))
end
end
@@ -1738,7 +1738,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "2", "deactivation_date(2i)": "", "deactivation_date(1i)": "2022" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.invalid"))
end
end
@@ -1747,7 +1747,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "2", "deactivation_date(2i)": "2", "deactivation_date(1i)": "" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.invalid"))
end
end
@@ -1758,7 +1758,7 @@ RSpec.describe LocationsController, type: :request do
let(:add_deactivations) { create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 5, 5), reactivation_date: Time.zone.local(2022, 10, 12), location:) }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.deactivation.during_deactivated_period"))
end
end
@@ -2110,7 +2110,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { "reactivation_date": "" } } }
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.not_selected"))
end
end
@@ -2119,7 +2119,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { reactivation_date_type: "other", "reactivation_date(3i)": "10", "reactivation_date(2i)": "44", "reactivation_date(1i)": "2022" } } }
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.invalid"))
end
end
@@ -2128,7 +2128,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { reactivation_date_type: "other", "reactivation_date(3i)": "10", "reactivation_date(2i)": "4", "reactivation_date(1i)": "2020" } } }
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.out_of_range", date: "1 April 2022"))
end
end
@@ -2137,7 +2137,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { reactivation_date_type: "other", "reactivation_date(3i)": "", "reactivation_date(2i)": "2", "reactivation_date(1i)": "2022" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.invalid"))
end
end
@@ -2146,7 +2146,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { reactivation_date_type: "other", "reactivation_date(3i)": "2", "reactivation_date(2i)": "", "reactivation_date(1i)": "2022" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.invalid"))
end
end
@@ -2155,7 +2155,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { reactivation_date_type: "other", "reactivation_date(3i)": "2", "reactivation_date(2i)": "2", "reactivation_date(1i)": "" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.toggle_date.invalid"))
end
end
@@ -2165,7 +2165,7 @@ RSpec.describe LocationsController, type: :request do
let(:params) { { location_deactivation_period: { reactivation_date_type: "other", "reactivation_date(3i)": "8", "reactivation_date(2i)": "9", "reactivation_date(1i)": "2022" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.location.reactivation.before_deactivation", date: "10 October 2022"))
end
end
diff --git a/spec/requests/merge_requests_controller_spec.rb b/spec/requests/merge_requests_controller_spec.rb
index 074d2186c..4c07dbfb7 100644
--- a/spec/requests/merge_requests_controller_spec.rb
+++ b/spec/requests/merge_requests_controller_spec.rb
@@ -95,7 +95,7 @@ RSpec.describe MergeRequestsController, type: :request do
end
it "displays the page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Another merge request records #{another_organisation.name} as merging into #{other_merge_request.absorbing_organisation&.name} on 4 May 2022. Select another organisation or remove this organisation from the other merge request.")
end
end
@@ -113,7 +113,7 @@ RSpec.describe MergeRequestsController, type: :request do
it "does not update the merge request" do
merge_request.reload
expect(merge_request.merging_organisations.count).to eq(0)
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.merge_request.organisation_part_of_another_merge"))
end
end
@@ -159,7 +159,7 @@ RSpec.describe MergeRequestsController, type: :request do
it "does not update the merge request" do
merge_request.reload
expect(merge_request.merging_organisations.count).to eq(0)
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.merge_request.organisation_not_selected"))
end
end
@@ -174,7 +174,7 @@ RSpec.describe MergeRequestsController, type: :request do
it "does not update the merge request" do
merge_request.reload
expect(merge_request.merging_organisations.count).to eq(0)
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.merge_request.organisation_not_selected"))
end
end
@@ -363,7 +363,7 @@ RSpec.describe MergeRequestsController, type: :request do
it "renders the error" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Enter a merge date")
end
@@ -385,7 +385,7 @@ RSpec.describe MergeRequestsController, type: :request do
it "displays the page with an error message" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Enter a valid merge date")
end
end
@@ -426,7 +426,7 @@ RSpec.describe MergeRequestsController, type: :request do
it "displays the page with an error message" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("The merge date must not be later than a year from today’s date.")
end
end
@@ -467,7 +467,7 @@ RSpec.describe MergeRequestsController, type: :request do
it "renders the error" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("You must answer absorbing organisation already active?")
end
@@ -490,7 +490,7 @@ RSpec.describe MergeRequestsController, type: :request do
it "renders the error" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("You must answer was this merge reported by a helpdesk ticket?")
end
@@ -511,7 +511,7 @@ RSpec.describe MergeRequestsController, type: :request do
it "renders the error" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("You must answer the ticket number")
end
diff --git a/spec/requests/notifications_controller_spec.rb b/spec/requests/notifications_controller_spec.rb
index 0982057ab..367c64550 100644
--- a/spec/requests/notifications_controller_spec.rb
+++ b/spec/requests/notifications_controller_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe NotificationsController, type: :request do
it "gives an error response" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
end
end
diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb
index af9027753..0a5614be3 100644
--- a/spec/requests/organisations_controller_spec.rb
+++ b/spec/requests/organisations_controller_spec.rb
@@ -1889,7 +1889,7 @@ RSpec.describe OrganisationsController, type: :request do
it "displays the form with an error message" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.organisation.name_missing"))
expect(page).to have_content(I18n.t("validations.organisation.provider_type_missing"))
end
@@ -2055,7 +2055,7 @@ RSpec.describe OrganisationsController, type: :request do
end
it "has clear filters link" do
- expect(page).to have_link("Clear", href: clear_filters_path(filter_type: "lettings_logs", path_params: { organisation_id: organisation.id }))
+ expect(page).to have_link("Clear", href: clear_filters_path(filter_type: "lettings_logs", filter_path_params: { organisation_id: organisation.id }))
end
end
end
@@ -2417,7 +2417,7 @@ RSpec.describe OrganisationsController, type: :request do
it "displays an error" do
post "/organisations/#{organisation.id}/schemes/duplicates", headers: headers, params: params
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("You must resolve all duplicates or indicate that there are no duplicates")
end
end
diff --git a/spec/requests/sales_logs_controller_spec.rb b/spec/requests/sales_logs_controller_spec.rb
index 840613458..06461bf4f 100644
--- a/spec/requests/sales_logs_controller_spec.rb
+++ b/spec/requests/sales_logs_controller_spec.rb
@@ -92,7 +92,7 @@ RSpec.describe SalesLogsController, type: :request do
it "validates sales log parameters" do
json_response = JSON.parse(response.body)
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(json_response["errors"]).to match_array([["beds", ["Number of bedrooms must be 1 if the property is a bedsit."]], ["proptype", ["Answer cannot be 'Bedsit' if the property has 2 or more bedrooms."]]])
end
end
diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb
index 2eb2330c8..713e54142 100644
--- a/spec/requests/schemes_controller_spec.rb
+++ b/spec/requests/schemes_controller_spec.rb
@@ -1057,7 +1057,7 @@ RSpec.describe SchemesController, type: :request do
it "renders the same page with error message" do
post "/schemes", params: params
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Create a new supported housing scheme")
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.scheme_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.registered_under_care_act.invalid"))
@@ -1185,7 +1185,7 @@ RSpec.describe SchemesController, type: :request do
it "renders the same page with error message" do
post "/schemes", params: params
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Create a new supported housing scheme")
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.scheme_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.registered_under_care_act.invalid"))
@@ -1318,7 +1318,7 @@ RSpec.describe SchemesController, type: :request do
it "renders the same page with error message" do
post "/schemes", params: params
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Create a new supported housing scheme")
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.scheme_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.registered_under_care_act.invalid"))
@@ -1334,7 +1334,7 @@ RSpec.describe SchemesController, type: :request do
it "displays the new page with an error message" do
post "/schemes", params: params
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Enter an organisation that owns housing stock")
end
end
@@ -1375,7 +1375,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme: { owning_organisation_id: user.organisation.id, arrangement_type: nil, confirmed: true, page: "check-answers" } } }
it "does not allow the scheme to be confirmed" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.arrangement_type.invalid"))
end
end
@@ -1417,7 +1417,7 @@ RSpec.describe SchemesController, type: :request do
end
it "renders the same page with error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Create a new supported housing scheme")
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.service_name.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.scheme_type.invalid"))
@@ -1684,7 +1684,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme: { owning_organisation_id: user.organisation.id, arrangement_type: nil, confirmed: true, page: "check-answers" } } }
it "does not allow the scheme to be confirmed" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.arrangement_type.invalid"))
end
end
@@ -1728,7 +1728,7 @@ RSpec.describe SchemesController, type: :request do
end
it "renders the same page with error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Create a new supported housing scheme")
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.owning_organisation_id.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.service_name.invalid"))
@@ -2895,7 +2895,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme_deactivation_period: { "deactivation_date": "" } } }
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.not_selected"))
end
end
@@ -2904,7 +2904,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "10", "deactivation_date(2i)": "44", "deactivation_date(1i)": "2022" } } }
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.invalid"))
end
end
@@ -2913,7 +2913,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "10", "deactivation_date(2i)": "4", "deactivation_date(1i)": "2020" } } }
it "displays the new page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.out_of_range", date: "1 April 2022"))
end
end
@@ -2922,7 +2922,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "", "deactivation_date(2i)": "2", "deactivation_date(1i)": "2022" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.invalid"))
end
end
@@ -2931,7 +2931,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "2", "deactivation_date(2i)": "", "deactivation_date(1i)": "2022" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.invalid"))
end
end
@@ -2940,7 +2940,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "2", "deactivation_date(2i)": "2", "deactivation_date(1i)": "" } } }
it "displays page with an error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.invalid"))
end
end
diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb
index 12418d532..257bd681a 100644
--- a/spec/requests/users_controller_spec.rb
+++ b/spec/requests/users_controller_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe UsersController, type: :request do
end
it "shows an error on the same page if passwords don't match" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_css("h1", class: "govuk-heading-l", text: "Change your password")
expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_content("passwords you entered do not match")
@@ -349,7 +349,7 @@ RSpec.describe UsersController, type: :request do
end
it "show an error" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
end
end
@@ -377,7 +377,7 @@ RSpec.describe UsersController, type: :request do
end
it "shows an error if passwords don't match" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_selector(".govuk-error-summary__title")
end
end
@@ -792,9 +792,8 @@ RSpec.describe UsersController, type: :request do
context "when the current user does not match the user ID" do
it "there is no route" do
- expect {
- get "/users/#{other_user.id}/password/edit", headers:, params: {}
- }.to raise_error(ActionController::RoutingError)
+ get "/users/#{other_user.id}/password/edit", headers:, params: {}
+ expect(response).to have_http_status(:not_found)
end
end
end
@@ -840,7 +839,7 @@ RSpec.describe UsersController, type: :request do
end
it "shows an error if passwords don't match" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_selector(".govuk-error-summary__title")
end
end
@@ -955,7 +954,7 @@ RSpec.describe UsersController, type: :request do
end
it "show an error" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
end
end
@@ -976,7 +975,7 @@ RSpec.describe UsersController, type: :request do
let(:phone) { "" }
it "validates telephone number" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.blank"))
end
end
@@ -985,7 +984,7 @@ RSpec.describe UsersController, type: :request do
let(:phone) { "randomstring" }
it "validates telephone number" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
@@ -994,7 +993,7 @@ RSpec.describe UsersController, type: :request do
let(:phone) { "123" }
it "validates telephone number" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
@@ -1075,7 +1074,7 @@ RSpec.describe UsersController, type: :request do
it "shows an error" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.email.taken"))
end
end
@@ -1093,7 +1092,7 @@ RSpec.describe UsersController, type: :request do
it "shows an error" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("validations.role.invalid"))
end
end
@@ -1111,7 +1110,7 @@ RSpec.describe UsersController, type: :request do
it "shows an error" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.name.blank"))
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.email.blank"))
end
@@ -1131,7 +1130,7 @@ RSpec.describe UsersController, type: :request do
it "validates telephone number" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
@@ -1141,7 +1140,7 @@ RSpec.describe UsersController, type: :request do
it "validates telephone number" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
@@ -1748,9 +1747,8 @@ RSpec.describe UsersController, type: :request do
context "when the current user does not match the user ID" do
it "there is no route" do
- expect {
- get "/users/#{other_user.id}/password/edit", headers:, params: {}
- }.to raise_error(ActionController::RoutingError)
+ get "/users/#{other_user.id}/password/edit", headers:, params: {}
+ expect(response).to have_http_status(:not_found)
end
end
end
@@ -1912,7 +1910,7 @@ RSpec.describe UsersController, type: :request do
end
it "shows an error if passwords don't match" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_selector(".govuk-error-summary__title")
end
end
@@ -1928,7 +1926,7 @@ RSpec.describe UsersController, type: :request do
let(:params) { { id: user.id, user: { organisation_id: "" } } }
it "does not update the organisation" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_selector(".govuk-error-summary__title")
end
end
@@ -2097,7 +2095,7 @@ RSpec.describe UsersController, type: :request do
let(:params) { { id: other_user.id, user: { organisation_id: "" } } }
it "does not update the organisation" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_selector(".govuk-error-summary__title")
end
end
@@ -2136,7 +2134,7 @@ RSpec.describe UsersController, type: :request do
end
it "displays the error message" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("Select if you want to reassign logs")
end
end
@@ -2184,7 +2182,7 @@ RSpec.describe UsersController, type: :request do
end
it "required the new org to have stock owner relationship with the current user org" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("New org must be a stock owner of #{other_user.organisation_name} to make this change.")
end
end
@@ -2198,7 +2196,7 @@ RSpec.describe UsersController, type: :request do
end
it "required the new org to have stock owner relationship with the managing organisations" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("New org must be a stock owner of #{other_user.organisation_name}, #{new_organisation_2.name}, and #{new_organisation_3.name} to make this change.")
end
end
@@ -2215,7 +2213,7 @@ RSpec.describe UsersController, type: :request do
end
it "required the new org to have managing agent relationship with the current user org" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("New org must be a managing agent of #{other_user.organisation_name} to make this change.")
end
end
@@ -2229,7 +2227,7 @@ RSpec.describe UsersController, type: :request do
end
it "required the new org to have managing agent relationship with owning organisations" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content("New org must be a managing agent of #{other_user.organisation.name}, #{new_organisation_2.name}, and #{new_organisation_3.name} to make this change.")
end
end
@@ -2246,7 +2244,7 @@ RSpec.describe UsersController, type: :request do
end
it "show an error" do
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
end
end
end
@@ -2309,7 +2307,7 @@ RSpec.describe UsersController, type: :request do
it "shows an error messages for all failed validations" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.name.blank"))
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.email.blank"))
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.organisation_id.blank"))
@@ -2324,7 +2322,7 @@ RSpec.describe UsersController, type: :request do
it "shows an error" do
request
- expect(response).to have_http_status(:unprocessable_entity)
+ expect(response).to have_http_status(:unprocessable_content)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.email.taken"))
end
end
diff --git a/spec/services/merge/merge_organisations_service_spec.rb b/spec/services/merge/merge_organisations_service_spec.rb
index fbb52c2a5..f20e16a16 100644
--- a/spec/services/merge/merge_organisations_service_spec.rb
+++ b/spec/services/merge/merge_organisations_service_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "when merging a single organisation into an existing organisation" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: nil) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids:, merge_date: nil) }
let(:absorbing_organisation) { create(:organisation, holds_own_stock: false, name: "absorbing org") }
let(:absorbing_organisation_user) { create(:user, organisation: absorbing_organisation) }
@@ -53,7 +53,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -97,7 +97,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -134,7 +134,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -327,7 +327,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "and deactivation is after the merge date and before an open collection window" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: Time.zone.today - 6.years) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids:, merge_date: Time.zone.today - 6.years) }
let!(:scheme) { create(:scheme, owning_organisation: merging_organisation, old_id: "scheme_old_id", old_visible_id: "scheme_old_visible_id", startdate: nil) }
let!(:location) { create(:location, scheme:, old_id: "location_old_id", old_visible_id: "location_old_visible_id", startdate: nil) }
@@ -551,7 +551,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -584,7 +584,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -596,7 +596,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "with merge date in closed collection year" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: Time.zone.local(2021, 3, 3)) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids:, merge_date: Time.zone.local(2021, 3, 3)) }
it "does not validate saledate for closed collection years" do
sales_log.saledate = Time.zone.local(2022, 5, 1)
@@ -611,7 +611,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "and merge date is provided" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: Time.zone.yesterday) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids:, merge_date: Time.zone.yesterday) }
it "sets merge date on merged organisation" do
merge_organisations_service.call
@@ -646,7 +646,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -682,7 +682,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -706,7 +706,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "with merge date in closed collection year" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: Time.zone.local(2021, 3, 3)) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids:, merge_date: Time.zone.local(2021, 3, 3)) }
it "does not validate startdate for closed collection years" do
owned_lettings_log.startdate = Time.zone.local(2022, 4, 1)
@@ -825,7 +825,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -842,7 +842,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "and absorbing_organisation_active_from_merge_date is true" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: Time.zone.yesterday, absorbing_organisation_active_from_merge_date: true) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids:, merge_date: Time.zone.yesterday, absorbing_organisation_active_from_merge_date: true) }
it "sets available from to merge_date for absorbing organisation" do
merge_organisations_service.call
@@ -854,7 +854,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "and absorbing_organisation_active_from_merge_date is true" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], absorbing_organisation_active_from_merge_date: true) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids:, absorbing_organisation_active_from_merge_date: true) }
it "sets available from to merge_date (today) for absorbing organisation" do
merge_organisations_service.call
@@ -910,7 +910,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "when merging a multiple organisations into an existing organisation" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: nil) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids:, merge_date: nil) }
let(:absorbing_organisation) { create(:organisation, holds_own_stock: false, name: "absorbing org") }
let(:absorbing_organisation_user) { create(:user, organisation: absorbing_organisation) }
@@ -944,7 +944,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1069,7 +1069,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation)
allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1086,7 +1086,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "and merge date is provided" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: Time.zone.yesterday) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: absorbing_organisation.id, merging_organisation_ids:, merge_date: Time.zone.yesterday) }
it "sets merge date and absorbing organisation on merged organisations" do
merge_organisations_service.call
@@ -1102,7 +1102,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "when merging a single organisation into a new organisation" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: nil) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids:, merge_date: nil) }
let(:new_absorbing_organisation) { create(:organisation, :without_dpc, holds_own_stock: false) }
let(:new_absorbing_organisation_user) { create(:user, organisation: new_absorbing_organisation) }
@@ -1139,7 +1139,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1183,7 +1183,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1220,7 +1220,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1325,7 +1325,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1357,7 +1357,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1370,7 +1370,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "and merge date is provided" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: Time.zone.yesterday) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids:, merge_date: Time.zone.yesterday) }
it "sets merge date on merged organisation" do
merge_organisations_service.call
@@ -1396,7 +1396,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1432,7 +1432,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1538,7 +1538,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1555,7 +1555,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "and absorbing_organisation_active_from_merge_date is true" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: Time.zone.yesterday, absorbing_organisation_active_from_merge_date: true) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids:, merge_date: Time.zone.yesterday, absorbing_organisation_active_from_merge_date: true) }
it "sets available from to merge_date for absorbing organisation" do
merge_organisations_service.call
@@ -1567,7 +1567,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "and absorbing_organisation_active_from_merge_date is true" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], absorbing_organisation_active_from_merge_date: true) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids:, absorbing_organisation_active_from_merge_date: true) }
it "sets available from to merge_date (today) for absorbing organisation" do
merge_organisations_service.call
@@ -1579,7 +1579,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "when merging multiple organisations into a new organisation" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: nil) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids:, merge_date: nil) }
let(:new_absorbing_organisation) { create(:organisation, :without_dpc, holds_own_stock: false) }
let(:new_absorbing_organisation_user) { create(:user, organisation: new_absorbing_organisation) }
@@ -1628,7 +1628,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1670,7 +1670,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
it "rolls back if there's an error" do
- allow(Organisation).to receive(:find).with([merging_organisation_ids]).and_return(Organisation.find(merging_organisation_ids))
+ allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids))
allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation)
allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid)
expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")
@@ -1687,7 +1687,7 @@ RSpec.describe Merge::MergeOrganisationsService do
end
context "and merge date is provided" do
- subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids: [merging_organisation_ids], merge_date: Time.zone.yesterday) }
+ subject(:merge_organisations_service) { described_class.new(absorbing_organisation_id: new_absorbing_organisation.id, merging_organisation_ids:, merge_date: Time.zone.yesterday) }
it "sets merge date and absorbing organisation on merged organisations" do
merge_organisations_service.call
diff --git a/yarn.lock b/yarn.lock
index 483095046..0c84d632e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3961,7 +3961,7 @@ jest-worker@^27.4.5:
merge-stream "^2.0.0"
supports-color "^8.0.0"
-jquery-ui@^1.12.1:
+"jquery-ui@^1.12.1 <1.14.0":
version "1.13.3"
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.13.3.tgz#d9f5292b2857fa1f2fdbbe8f2e66081664eb9bc5"
integrity sha512-D2YJfswSJRh/B8M/zCowDpNFfwsDmtfnMPwjJTyvl+CBqzpYwQ+gFYIbUUlzijy/Qvoy30H1YhoSui4MNYpRwA==
@@ -4824,10 +4824,10 @@ queue-tick@^1.0.1:
resolved "https://registry.yarnpkg.com/queue-tick/-/queue-tick-1.0.1.tgz#f6f07ac82c1fd60f82e098b417a80e52f1f4c142"
integrity sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==
-rails_admin@3.1.3:
- version "3.1.3"
- resolved "https://registry.yarnpkg.com/rails_admin/-/rails_admin-3.1.3.tgz#1da3f2214876f4ffd3a1db01452c28a8f7d4d989"
- integrity sha512-79CBB2BMB3fSGPz1P8eNxCboHVlkBWBaxKxfo4QwCAFxsA3WAjfM0MeWUtGHI8Mn8XEZxCdEDz9oYlvlBpMtng==
+rails_admin@3.3.0:
+ version "3.3.0"
+ resolved "https://registry.yarnpkg.com/rails_admin/-/rails_admin-3.3.0.tgz#58701b189e40b7c7f9a0a8ba2b996a41d5842017"
+ integrity sha512-sgdLMdJDOQmkEWYXY0uqLYxi7eMdhCEU4ZuKpVKdSssMoOr9iqCX8/sOP4ErRiC8Iez5x1vXVOv0Iki4ZKCNug==
dependencies:
"@babel/runtime" "^7.16.7"
"@fortawesome/fontawesome-free" ">=5.15.0 <7.0.0"
@@ -4837,7 +4837,7 @@ rails_admin@3.1.3:
bootstrap "^5.1.3"
flatpickr "^4.6.9"
jquery "^3.6.0"
- jquery-ui "^1.12.1"
+ jquery-ui "^1.12.1 <1.14.0"
random-bytes@~1.0.0:
version "1.0.0"
From dace19377402cefccf43d40e808ae0040844013b Mon Sep 17 00:00:00 2001
From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com>
Date: Mon, 16 Dec 2024 09:07:36 +0000
Subject: [PATCH 08/11] CLDC-3677 Update BU content (#2845)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Change instances of “reupload” to “upload again”, remove inset text
* Change bu filter wording
* Update heading
* Update fix choice content
---
app/components/bulk_upload_error_row_component.html.erb | 2 +-
app/helpers/logs_helper.rb | 2 +-
.../forms/bulk_upload_lettings_resume/fix_choice.rb | 2 +-
app/models/forms/bulk_upload_sales_resume/fix_choice.rb | 2 +-
.../forms/prepare_your_file_2024.html.erb | 2 --
.../bulk_upload_lettings_resume/deletion_report.html.erb | 2 +-
.../confirm.html.erb | 2 +-
.../bulk_upload_sales_resume/deletion_report.html.erb | 2 +-
.../confirm.html.erb | 2 +-
app/views/bulk_upload_shared/_moved_user_banner.html.erb | 4 ++--
app/views/bulk_upload_shared/guidance.html.erb | 2 +-
.../bulk_upload_lettings_results_controller_spec.rb | 8 ++++----
...oad_lettings_soft_validations_check_controller_spec.rb | 2 +-
.../requests/bulk_upload_sales_results_controller_spec.rb | 8 ++++----
...upload_sales_soft_validations_check_controller_spec.rb | 2 +-
spec/requests/lettings_logs_controller_spec.rb | 4 ++--
spec/requests/sales_logs_controller_spec.rb | 4 ++--
17 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/app/components/bulk_upload_error_row_component.html.erb b/app/components/bulk_upload_error_row_component.html.erb
index 4bd303957..db1ceab7a 100644
--- a/app/components/bulk_upload_error_row_component.html.erb
+++ b/app/components/bulk_upload_error_row_component.html.erb
@@ -38,7 +38,7 @@
<% if potential_errors.any? %>
Potential errors
-
The following groups of cells might have conflicting data. Check the answers and fix any incorrect data.
If the answers are correct, fix the critical errors and reupload the file. You'll need to confirm that the following data is correct when the file only contains potential errors.
+
The following groups of cells might have conflicting data. Check the answers and fix any incorrect data.
If the answers are correct, fix the critical errors and upload the file again. You'll need to confirm that the following data is correct when the file only contains potential errors.
<%= govuk_table(html_attributes: { class: "no-bottom-border" }) do |table| %>
<%= table.with_head do |head| %>
<% head.with_row do |row| %>
diff --git a/app/helpers/logs_helper.rb b/app/helpers/logs_helper.rb
index 4b8f6211f..981642f92 100644
--- a/app/helpers/logs_helper.rb
+++ b/app/helpers/logs_helper.rb
@@ -10,7 +10,7 @@ module LogsHelper
def bulk_upload_options(bulk_upload)
array = bulk_upload ? [bulk_upload.id] : []
- array.index_with { |_bulk_upload_id| "With logs from bulk upload" }
+ array.index_with { |_bulk_upload_id| "Only logs from this bulk upload" }
end
def search_label_for_controller(controller)
diff --git a/app/models/forms/bulk_upload_lettings_resume/fix_choice.rb b/app/models/forms/bulk_upload_lettings_resume/fix_choice.rb
index 5ee4d37fd..40ada602e 100644
--- a/app/models/forms/bulk_upload_lettings_resume/fix_choice.rb
+++ b/app/models/forms/bulk_upload_lettings_resume/fix_choice.rb
@@ -14,7 +14,7 @@ module Forms
def options
[
OpenStruct.new(id: "create-fix-inline", name: "Upload these logs and fix errors on CORE site"),
- OpenStruct.new(id: "upload-again", name: "Fix errors in the CSV and re-upload"),
+ OpenStruct.new(id: "upload-again", name: "Fix errors in the CSV and upload the file again"),
]
end
diff --git a/app/models/forms/bulk_upload_sales_resume/fix_choice.rb b/app/models/forms/bulk_upload_sales_resume/fix_choice.rb
index b34f50d3a..79d06529a 100644
--- a/app/models/forms/bulk_upload_sales_resume/fix_choice.rb
+++ b/app/models/forms/bulk_upload_sales_resume/fix_choice.rb
@@ -14,7 +14,7 @@ module Forms
def options
[
OpenStruct.new(id: "create-fix-inline", name: "Upload these logs and fix errors on CORE site"),
- OpenStruct.new(id: "upload-again", name: "Fix errors in the CSV and re-upload"),
+ OpenStruct.new(id: "upload-again", name: "Fix errors in the CSV and upload the file again"),
]
end
diff --git a/app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2024.html.erb b/app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2024.html.erb
index 3e7f0443c..ce873b6d7 100644
--- a/app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2024.html.erb
+++ b/app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2024.html.erb
@@ -27,8 +27,6 @@
"If you have reordered the headers, keep the headers in the file.",
], type: :bullet %>
- <%= govuk_inset_text(text: "You can upload both general needs and supported housing logs in the same file for 2024 to 2025 data.") %>
-
Save your file
<%= govuk_list ["Save your file as a CSV.", "Your file should now be ready to upload."], type: :bullet %>
diff --git a/app/views/bulk_upload_lettings_resume/deletion_report.html.erb b/app/views/bulk_upload_lettings_resume/deletion_report.html.erb
index a13979dfd..d3533a130 100644
--- a/app/views/bulk_upload_lettings_resume/deletion_report.html.erb
+++ b/app/views/bulk_upload_lettings_resume/deletion_report.html.erb
@@ -28,6 +28,6 @@
<%= form_with model: @form, scope: :form, url: page_bulk_upload_lettings_resume_path(@bulk_upload, "confirm"), method: :patch do |f| %>
<%= f.govuk_submit "Clear this data and upload the logs" %>
- <%= govuk_button_link_to "I have fixed these errors and I want to reupload the file", start_bulk_upload_lettings_logs_path, secondary: true %>
+ <%= govuk_button_link_to "I have fixed these errors and I want to upload the file again", start_bulk_upload_lettings_logs_path, secondary: true %>
<% end %>
<%= form_with model: @form, scope: :form, url: page_bulk_upload_sales_resume_path(@bulk_upload, "confirm"), method: :patch do |f| %>
<%= f.govuk_submit "Clear this data and upload the logs" %>
- <%= govuk_button_link_to "I have fixed these errors and I want to reupload the file", start_bulk_upload_sales_logs_path, secondary: true %>
+ <%= govuk_button_link_to "I have fixed these errors and I want to upload the file again", start_bulk_upload_sales_logs_path, secondary: true %>
<% end %>
diff --git a/app/views/bulk_upload_shared/_moved_user_banner.html.erb b/app/views/bulk_upload_shared/_moved_user_banner.html.erb
index 9ab97022e..220405cc5 100644
--- a/app/views/bulk_upload_shared/_moved_user_banner.html.erb
+++ b/app/views/bulk_upload_shared/_moved_user_banner.html.erb
@@ -4,9 +4,9 @@
This error report is out of date.
<% if current_user.id == @bulk_upload.moved_user_id %>
- You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.
+ You moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.
<% else %>
- Some logs in this upload are assigned to <%= @bulk_upload.moved_user_name %>, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.
+ Some logs in this upload are assigned to <%= @bulk_upload.moved_user_name %>, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.
<% end %>
<% end %>
<% end %>
diff --git a/app/views/bulk_upload_shared/guidance.html.erb b/app/views/bulk_upload_shared/guidance.html.erb
index d3950fff7..54e8063f0 100644
--- a/app/views/bulk_upload_shared/guidance.html.erb
+++ b/app/views/bulk_upload_shared/guidance.html.erb
@@ -75,7 +75,7 @@
Once you've saved your CSV file, you can upload it via a button at the top of the lettings and sales logs pages.
When your file is done processing, you will receive an email explaining your next steps. If all your data is valid, your logs will be created. If some data is invalid, you’ll receive an email with instructions about how to resolve the errors.
If your file has errors on fields 1 through 15 for lettings, or 1 through 18 for sales, you must fix these in the CSV. This is because we need to know these answers to validate the rest of the data. Any errors in these fields will be featured in the error report’s summary tab.
-
If none of your errors are in fields 1 through 15 for lettings, or 1 through 18 for sales, you can choose how to fix the errors. You can either fix them in the CSV and reupload, or create partially complete logs and answer the remaining questions on the CORE site. Any errors that affect a significant number of logs will be featured in the error report’s summary tab to help you decide.
+
If none of your errors are in fields 1 through 15 for lettings, or 1 through 18 for sales, you can choose how to fix the errors. You can either fix them in the CSV and upload the file again, or create partially complete logs and answer the remaining questions on the CORE site. Any errors that affect a significant number of logs will be featured in the error report’s summary tab to help you decide.
<% end %>
diff --git a/spec/requests/bulk_upload_lettings_results_controller_spec.rb b/spec/requests/bulk_upload_lettings_results_controller_spec.rb
index b23cb2c17..3c84487ac 100644
--- a/spec/requests/bulk_upload_lettings_results_controller_spec.rb
+++ b/spec/requests/bulk_upload_lettings_results_controller_spec.rb
@@ -68,7 +68,7 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
- expect(CGI.unescapeHTML(response.body)).to include("Some logs in this upload are assigned to #{user.name}, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
+ expect(CGI.unescapeHTML(response.body)).to include("Some logs in this upload are assigned to #{user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
@@ -79,7 +79,7 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
- expect(response.body).to include("You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
+ expect(response.body).to include("You moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
end
@@ -138,7 +138,7 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
- expect(response.body).to include("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
+ expect(response.body).to include("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
@@ -149,7 +149,7 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
- expect(response.body).to include("You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
+ expect(response.body).to include("You moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
end
diff --git a/spec/requests/bulk_upload_lettings_soft_validations_check_controller_spec.rb b/spec/requests/bulk_upload_lettings_soft_validations_check_controller_spec.rb
index 315235e0e..2a2668d60 100644
--- a/spec/requests/bulk_upload_lettings_soft_validations_check_controller_spec.rb
+++ b/spec/requests/bulk_upload_lettings_soft_validations_check_controller_spec.rb
@@ -98,7 +98,7 @@ RSpec.describe BulkUploadLettingsSoftValidationsCheckController, type: :request
expect(response).to be_successful
- expect(response.body).to include("You have chosen to upload all logs from this bulk upload.")
+ expect(response.body).to include("Are you sure you want to upload all logs from this bulk upload?")
expect(response.body).to include("You will upload 2 logs. There are unexpected answers in 2 logs, and 2 unexpected answers in total. These unexpected answers will be marked as correct.")
expect(response.body).not_to include("You’ve successfully uploaded")
end
diff --git a/spec/requests/bulk_upload_sales_results_controller_spec.rb b/spec/requests/bulk_upload_sales_results_controller_spec.rb
index b7bb7a10c..e58303d68 100644
--- a/spec/requests/bulk_upload_sales_results_controller_spec.rb
+++ b/spec/requests/bulk_upload_sales_results_controller_spec.rb
@@ -30,7 +30,7 @@ RSpec.describe BulkUploadSalesResultsController, type: :request do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
- expect(response.body).to include("Some logs in this upload are assigned to #{user.name}, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
+ expect(response.body).to include("Some logs in this upload are assigned to #{user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
@@ -41,7 +41,7 @@ RSpec.describe BulkUploadSalesResultsController, type: :request do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
- expect(response.body).to include("You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
+ expect(response.body).to include("You moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
end
@@ -113,7 +113,7 @@ RSpec.describe BulkUploadSalesResultsController, type: :request do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
- expect(response.body).to include("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
+ expect(response.body).to include("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
@@ -124,7 +124,7 @@ RSpec.describe BulkUploadSalesResultsController, type: :request do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
- expect(response.body).to include("You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
+ expect(response.body).to include("You moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
end
diff --git a/spec/requests/bulk_upload_sales_soft_validations_check_controller_spec.rb b/spec/requests/bulk_upload_sales_soft_validations_check_controller_spec.rb
index 90e44a4f7..a3a826ad3 100644
--- a/spec/requests/bulk_upload_sales_soft_validations_check_controller_spec.rb
+++ b/spec/requests/bulk_upload_sales_soft_validations_check_controller_spec.rb
@@ -98,7 +98,7 @@ RSpec.describe BulkUploadSalesSoftValidationsCheckController, type: :request do
expect(response).to be_successful
- expect(response.body).to include("You have chosen to upload all logs from this bulk upload.")
+ expect(response.body).to include("Are you sure you want to upload all logs from this bulk upload?")
expect(response.body).to include("You will upload 2 logs. There are unexpected answers in 2 logs, and 2 unexpected answers in total. These unexpected answers will be marked as correct.")
expect(response.body).not_to include("You’ve successfully uploaded")
end
diff --git a/spec/requests/lettings_logs_controller_spec.rb b/spec/requests/lettings_logs_controller_spec.rb
index 14cd3095c..05d83a162 100644
--- a/spec/requests/lettings_logs_controller_spec.rb
+++ b/spec/requests/lettings_logs_controller_spec.rb
@@ -609,7 +609,7 @@ RSpec.describe LettingsLogsController, type: :request do
it "displays filter" do
get "/lettings-logs?bulk_upload_id[]=#{bulk_upload.id}"
- expect(page).to have_content("With logs from bulk upload")
+ expect(page).to have_content("Only logs from this bulk upload")
end
it "hides collection year filter" do
@@ -695,7 +695,7 @@ RSpec.describe LettingsLogsController, type: :request do
context "without bulk_upload_id" do
it "does not display filter" do
get "/lettings-logs"
- expect(page).not_to have_content("With logs from bulk upload")
+ expect(page).not_to have_content("Only logs from this bulk upload")
end
it "displays button to create a new log" do
diff --git a/spec/requests/sales_logs_controller_spec.rb b/spec/requests/sales_logs_controller_spec.rb
index 06461bf4f..d8209fa1d 100644
--- a/spec/requests/sales_logs_controller_spec.rb
+++ b/spec/requests/sales_logs_controller_spec.rb
@@ -452,7 +452,7 @@ RSpec.describe SalesLogsController, type: :request do
it "displays filter" do
get "/sales-logs?bulk_upload_id[]=#{bulk_upload.id}"
- expect(page).to have_content("With logs from bulk upload")
+ expect(page).to have_content("Only logs from this bulk upload")
end
it "hides collection year filter" do
@@ -536,7 +536,7 @@ RSpec.describe SalesLogsController, type: :request do
context "without bulk_upload_id" do
it "does not display filter" do
get "/sales-logs"
- expect(page).not_to have_content("With logs from bulk upload")
+ expect(page).not_to have_content("Only logs from this bulk upload")
end
it "displays button to create a new log" do
From 6c97ba7634a594ff542296341834516d22bf6c4c Mon Sep 17 00:00:00 2001
From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com>
Date: Mon, 16 Dec 2024 10:03:21 +0000
Subject: [PATCH 09/11] Bug fix (#2870)
---
config/locales/validations/sales/2024/bulk_upload.en.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/locales/validations/sales/2024/bulk_upload.en.yml b/config/locales/validations/sales/2024/bulk_upload.en.yml
index 2621386c1..4a2d88b46 100644
--- a/config/locales/validations/sales/2024/bulk_upload.en.yml
+++ b/config/locales/validations/sales/2024/bulk_upload.en.yml
@@ -18,8 +18,8 @@ en:
owning_organisation:
not_found: "The owning organisation code is incorrect."
not_stock_owner: "The owning organisation code provided is for an organisation that does not own stock."
- not_permitted:
- support: "This owning organisation is not affiliated with %(name)."
+ not_permitted:
+ support: "This owning organisation is not affiliated with %{name}."
not_support: "You do not have permission to add logs for this owning organisation."
assigned_to:
not_found: "User with the specified email could not be found."
From 456d1e658628720808e03e376866bfeb733b9c92 Mon Sep 17 00:00:00 2001
From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com>
Date: Mon, 16 Dec 2024 10:20:19 +0000
Subject: [PATCH 10/11] Do not run pregnancy validations if hhmemb is over 8
(#2869)
---
app/models/validations/soft_validations.rb | 4 +++
.../validations/soft_validations_spec.rb | 28 +++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/app/models/validations/soft_validations.rb b/app/models/validations/soft_validations.rb
index 0b76f792b..1a2c61138 100644
--- a/app/models/validations/soft_validations.rb
+++ b/app/models/validations/soft_validations.rb
@@ -84,6 +84,8 @@ module Validations::SoftValidations
end
def all_tenants_age_and_gender_information_completed?
+ return false if hhmemb.present? && hhmemb > 8
+
person_count = hhmemb || 8
(1..person_count).all? do |n|
@@ -235,6 +237,8 @@ private
end
def all_male_tenants_in_the_household?
+ return false if hhmemb.present? && hhmemb > 8
+
person_count = hhmemb || 8
(1..person_count).all? do |n|
diff --git a/spec/models/validations/soft_validations_spec.rb b/spec/models/validations/soft_validations_spec.rb
index 8c7380fde..b4188ba8c 100644
--- a/spec/models/validations/soft_validations_spec.rb
+++ b/spec/models/validations/soft_validations_spec.rb
@@ -174,6 +174,20 @@ RSpec.describe Validations::SoftValidations do
end
end
+ context "when all tenants are male and household members are over 8" do
+ it "does not show the interruption screen" do
+ (1..8).each do |n|
+ record.send("sex#{n}=", "M")
+ record.send("age#{n}=", 30)
+ record.send("age#{n}_known=", 0)
+ record.send("details_known_#{n}=", 0) unless n == 1
+ end
+ record.preg_occ = 1
+ record.hhmemb = 9
+ expect(record.all_male_tenants_in_a_pregnant_household?).to be false
+ end
+ end
+
context "when female tenants are under 16" do
it "shows the interruption screen" do
record.age2 = 14
@@ -219,6 +233,20 @@ RSpec.describe Validations::SoftValidations do
expect(record.female_in_pregnant_household_in_soft_validation_range?).to be false
end
end
+
+ context "when number of household members is over 8" do
+ it "does not show the interruption screen" do
+ (1..8).each do |n|
+ record.send("sex#{n}=", "F")
+ record.send("age#{n}=", 50)
+ record.send("age#{n}_known=", 0)
+ record.send("details_known_#{n}=", 0) unless n == 1
+ end
+ record.preg_occ = 1
+ record.hhmemb = 9
+ expect(record.female_in_pregnant_household_in_soft_validation_range?).to be false
+ end
+ end
end
describe "major repairs date soft validations" do
From b8503aa0c663eb221c7b1a6ce84edfe0ca858f42 Mon Sep 17 00:00:00 2001
From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com>
Date: Mon, 16 Dec 2024 10:20:34 +0000
Subject: [PATCH 11/11] Remove old feature flags (#2862)
---
app/controllers/lettings_logs_controller.rb | 2 +-
app/controllers/organisations_controller.rb | 4 ++--
app/controllers/sales_logs_controller.rb | 2 +-
app/services/feature_toggle.rb | 16 ----------------
app/views/locations/check_answers.html.erb | 2 +-
app/views/locations/show.html.erb | 2 +-
app/views/schemes/check_answers.html.erb | 2 +-
app/views/schemes/show.html.erb | 2 +-
app/views/users/show.html.erb | 2 +-
9 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/app/controllers/lettings_logs_controller.rb b/app/controllers/lettings_logs_controller.rb
index af3a6c32f..7fef9499b 100644
--- a/app/controllers/lettings_logs_controller.rb
+++ b/app/controllers/lettings_logs_controller.rb
@@ -22,7 +22,7 @@ class LettingsLogsController < LogsController
@total_count = all_logs.size
@unresolved_count = all_logs.unresolved.assigned_to(current_user).count
@filter_type = "lettings_logs"
- @duplicate_sets_count = FeatureToggle.duplicate_summary_enabled? && !current_user.support? ? duplicate_sets_count(current_user, current_user.organisation) : 0
+ @duplicate_sets_count = !current_user.support? ? duplicate_sets_count(current_user, current_user.organisation) : 0
render "logs/index"
end
diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb
index 93b667a99..a6d9fb61e 100644
--- a/app/controllers/organisations_controller.rb
+++ b/app/controllers/organisations_controller.rb
@@ -186,7 +186,7 @@ class OrganisationsController < ApplicationController
@total_count = organisation_logs.size
@log_type = :lettings
@filter_type = "lettings_logs"
- @duplicate_sets_count = FeatureToggle.duplicate_summary_enabled? ? duplicate_sets_count(current_user, @organisation) : 0
+ @duplicate_sets_count = duplicate_sets_count(current_user, @organisation)
render "logs", layout: "application"
end
@@ -218,7 +218,7 @@ class OrganisationsController < ApplicationController
@total_count = organisation_logs.size
@log_type = :sales
@filter_type = "sales_logs"
- @duplicate_sets_count = FeatureToggle.duplicate_summary_enabled? ? duplicate_sets_count(current_user, @organisation) : 0
+ @duplicate_sets_count = duplicate_sets_count(current_user, @organisation)
render "logs", layout: "application"
end
diff --git a/app/controllers/sales_logs_controller.rb b/app/controllers/sales_logs_controller.rb
index 8799fe528..237fd94d7 100644
--- a/app/controllers/sales_logs_controller.rb
+++ b/app/controllers/sales_logs_controller.rb
@@ -24,7 +24,7 @@ class SalesLogsController < LogsController
@searched = search_term.presence
@total_count = all_logs.size
@filter_type = "sales_logs"
- @duplicate_sets_count = FeatureToggle.duplicate_summary_enabled? && !current_user.support? ? duplicate_sets_count(current_user, current_user.organisation) : 0
+ @duplicate_sets_count = !current_user.support? ? duplicate_sets_count(current_user, current_user.organisation) : 0
render "logs/index"
end
diff --git a/app/services/feature_toggle.rb b/app/services/feature_toggle.rb
index 065c3b54e..8c3fe9362 100644
--- a/app/services/feature_toggle.rb
+++ b/app/services/feature_toggle.rb
@@ -11,10 +11,6 @@ class FeatureToggle
!Rails.env.development?
end
- def self.duplicate_summary_enabled?
- true
- end
-
def self.service_unavailable?
false
end
@@ -23,18 +19,6 @@ class FeatureToggle
false
end
- def self.delete_scheme_enabled?
- true
- end
-
- def self.delete_location_enabled?
- true
- end
-
- def self.delete_user_enabled?
- true
- end
-
def self.local_storage?
Rails.env.development?
end
diff --git a/app/views/locations/check_answers.html.erb b/app/views/locations/check_answers.html.erb
index 8cd8bde2a..7a3a72e13 100644
--- a/app/views/locations/check_answers.html.erb
+++ b/app/views/locations/check_answers.html.erb
@@ -42,7 +42,7 @@
<% if LocationPolicy.new(current_user, @location).create? %>
<%= govuk_button_to "Save and return to locations", scheme_location_confirm_path(@scheme, @location, route: params[:route]), method: :patch %>
- <% if LocationPolicy.new(current_user, @location).delete? && FeatureToggle.delete_location_enabled? %>
+ <% if LocationPolicy.new(current_user, @location).delete? %>
<%= delete_location_link(@location) %>
<% end %>
<%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %>
diff --git a/app/views/locations/show.html.erb b/app/views/locations/show.html.erb
index f9ba6496c..0cb09af8f 100644
--- a/app/views/locations/show.html.erb
+++ b/app/views/locations/show.html.erb
@@ -51,6 +51,6 @@
<%= toggle_location_link(@location) %>
<% end %>
-<% if LocationPolicy.new(current_user, @location).delete? && FeatureToggle.delete_location_enabled? %>
+<% if LocationPolicy.new(current_user, @location).delete? %>
<%= delete_location_link(@location) %>
<% end %>
diff --git a/app/views/schemes/check_answers.html.erb b/app/views/schemes/check_answers.html.erb
index 3f8365f6e..a98c86a51 100644
--- a/app/views/schemes/check_answers.html.erb
+++ b/app/views/schemes/check_answers.html.erb
@@ -24,7 +24,7 @@
<%= f.govuk_submit button_label %>
<% end %>
- <% if SchemePolicy.new(current_user, @scheme).delete? && FeatureToggle.delete_scheme_enabled? %>
+ <% if SchemePolicy.new(current_user, @scheme).delete? %>
<%= delete_scheme_link(@scheme) %>
<% end %>
<% end %>
diff --git a/app/views/schemes/show.html.erb b/app/views/schemes/show.html.erb
index 0aa25affc..58bcd521e 100644
--- a/app/views/schemes/show.html.erb
+++ b/app/views/schemes/show.html.erb
@@ -56,6 +56,6 @@
<%= toggle_scheme_link(@scheme) %>
<% end %>
-<% if SchemePolicy.new(current_user, @scheme).delete? && FeatureToggle.delete_scheme_enabled? %>
+<% if SchemePolicy.new(current_user, @scheme).delete? %>
<%= delete_scheme_link(@scheme) %>
<% end %>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index a43b03f82..d6f2c1e88 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -157,7 +157,7 @@
<% end %>
<% end %>
- <% if UserPolicy.new(current_user, @user).delete? && FeatureToggle.delete_user_enabled? %>
+ <% if UserPolicy.new(current_user, @user).delete? %>
<%= delete_user_link(@user) %>
<% end %>