Browse Source

Merge branch 'main' into MigrationImprovements

pull/1799/head
Rachael Booth 3 years ago committed by GitHub
parent
commit
e845bb5f51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .github/workflows/production_pipeline.yml
  2. 6
      .github/workflows/staging_pipeline.yml
  3. 2
      .nvmrc
  4. 2
      .ruby-version
  5. 4
      Dockerfile
  6. 2
      Dockerfile_dev
  7. 2
      Gemfile
  8. 2
      Gemfile.lock
  9. 10
      app/components/bulk_upload_error_row_component.html.erb
  10. 8
      app/components/check_answers_summary_list_card_component.html.erb
  11. 2
      app/frontend/application.js
  12. 2
      app/frontend/controllers/govukfrontend_controller.js
  13. 4
      app/helpers/filters_helper.rb
  14. 11
      app/helpers/organisation_helper.rb
  15. 40
      app/helpers/organisations_helper.rb
  16. 2
      app/helpers/tag_helper.rb
  17. 23
      app/models/organisation.rb
  18. 7
      app/models/user.rb
  19. 6
      app/models/validations/household_validations.rb
  20. 2
      app/services/exports/lettings_log_export_constants.rb
  21. 2
      app/services/imports/lettings_logs_import_service.rb
  22. 4
      app/views/form/_interruption_screen_question.html.erb
  23. 8
      app/views/form/review.html.erb
  24. 4
      app/views/organisations/_organisation_list.html.erb
  25. 5
      app/views/organisations/edit.html.erb
  26. 3
      app/views/organisations/show.html.erb
  27. 2
      config/cloud_foundry/review_manifest.yml
  28. 5
      config/locales/en.yml
  29. 5
      db/migrate/20230718151955_add_merge_date_to_organisation.rb
  30. 29
      db/schema.rb
  31. 4
      docs/setup.md
  32. 2
      manifest.yml
  33. 6
      package.json
  34. 6
      spec/features/form/check_answers_page_lettings_logs_spec.rb
  35. 30
      spec/features/form/check_answers_page_sales_logs_spec.rb
  36. 14
      spec/features/lettings_log_spec.rb
  37. 2
      spec/fixtures/exports/general_needs_log.xml
  38. 2
      spec/fixtures/exports/general_needs_log_23_24.xml
  39. 2
      spec/fixtures/exports/supported_housing_logs.xml
  40. 5
      spec/helpers/filters_helper_spec.rb
  41. 23
      spec/helpers/organisations_helper_spec.rb
  42. 1
      spec/helpers/tag_helper_spec.rb
  43. 19
      spec/models/organisation_spec.rb
  44. 10
      spec/models/user_spec.rb
  45. 8
      spec/models/validations/household_validations_spec.rb
  46. 8
      spec/requests/organisations_controller_spec.rb
  47. 4
      spec/services/imports/lettings_logs_import_service_spec.rb
  48. 2
      spec/views/bulk_upload_lettings_results/show.html.erb_spec.rb
  49. 2
      spec/views/bulk_upload_lettings_results/summary.html.erb_spec.rb
  50. 2
      spec/views/bulk_upload_sales_results/show.html.erb_spec.rb
  51. 2
      spec/views/bulk_upload_sales_results/summary.html.erb_spec.rb
  52. 2
      webpack.config.js
  53. 2138
      yarn.lock

4
.github/workflows/production_pipeline.yml

@ -68,7 +68,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Create database - name: Create database
run: | run: |
@ -127,7 +127,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Create database - name: Create database
run: | run: |

6
.github/workflows/staging_pipeline.yml

@ -60,7 +60,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Create database - name: Create database
run: | run: |
@ -118,7 +118,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Create database - name: Create database
run: | run: |
@ -149,7 +149,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Install packages and symlink local dependencies - name: Install packages and symlink local dependencies
run: | run: |

2
.nvmrc

@ -1 +1 @@
16 18

2
.ruby-version

@ -1 +1 @@
3.1.2 3.1.4

4
Dockerfile

@ -1,5 +1,5 @@
# Build compilation image # Build compilation image
FROM ruby:3.1.2-alpine as builder FROM ruby:3.1.4-alpine as builder
# The application runs from /app # The application runs from /app
WORKDIR /app WORKDIR /app
@ -45,7 +45,7 @@ RUN rm -rf node_modules log tmp && \
find /usr/local/bundle/gems -name "*.html" -delete find /usr/local/bundle/gems -name "*.html" -delete
# Build runtime image # Build runtime image
FROM ruby:3.1.2-alpine as production FROM ruby:3.1.4-alpine as production
# The application runs from /app # The application runs from /app
WORKDIR /app WORKDIR /app

2
Dockerfile_dev

@ -1,5 +1,5 @@
# Build compilation image # Build compilation image
FROM ruby:3.1.2-alpine FROM ruby:3.1.4-alpine
# The application runs from /app # The application runs from /app
WORKDIR /app WORKDIR /app

2
Gemfile

@ -3,7 +3,7 @@
source "https://rubygems.org" source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" } git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.2" ruby "3.1.4"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem "rails", "~> 7.0.2" gem "rails", "~> 7.0.2"

2
Gemfile.lock

@ -501,7 +501,7 @@ DEPENDENCIES
webmock webmock
RUBY VERSION RUBY VERSION
ruby 3.1.2p20 ruby 3.1.4p223
BUNDLED WITH BUNDLED WITH
2.3.14 2.3.14

10
app/components/bulk_upload_error_row_component.html.erb

@ -1,13 +1,13 @@
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> <div class="govuk-summary-card govuk-!-margin-bottom-6">
<div class="x-govuk-summary-card__header"> <div class="govuk-summary-card__title-wrapper">
<% if lettings? %> <% if lettings? %>
<h3 class="x-govuk-summary-card__title"><strong>Row <%= row %></strong> <%= tenant_code_html %> <%= property_ref_html %></h3> <h3 class="govuk-summary-card__title"><strong>Row <%= row %></strong> <%= tenant_code_html %> <%= property_ref_html %></h3>
<% else %> <% else %>
<h3 class="x-govuk-summary-card__title"><strong>Row <%= row %></strong> <%= purchaser_code_html %></h3> <h3 class="govuk-summary-card__title"><strong>Row <%= row %></strong> <%= purchaser_code_html %></h3>
<% end %> <% end %>
</div> </div>
<div class="x-govuk-summary-card__body"> <div class="govuk-summary-card__content">
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<% table.head do |head| %> <% table.head do |head| %>
<% head.row do |row| %> <% head.row do |row| %>

8
app/components/check_answers_summary_list_card_component.html.erb

@ -1,12 +1,12 @@
<% if applicable_questions.first %> <% if applicable_questions.first %>
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> <div class="govuk-summary-card govuk-!-margin-bottom-6">
<% if applicable_questions.first.check_answers_card_number != 0 && applicable_questions.first.check_answers_card_number.present? %> <% if applicable_questions.first.check_answers_card_number != 0 && applicable_questions.first.check_answers_card_number.present? %>
<div class="x-govuk-summary-card__header"> <div class="govuk-summary-card__title-wrapper">
<h3 class="x-govuk-summary-card__title"><%= check_answers_card_title(applicable_questions.first) %></h3> <h3 class="govuk-summary-card__title"><%= check_answers_card_title(applicable_questions.first) %></h3>
</div> </div>
<% end %> <% end %>
<div class="x-govuk-summary-card__body"> <div class="govuk-summary-card__content">
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% applicable_questions.each do |question| %> <% applicable_questions.each do |question| %>
<% summary_list.row do |row| %> <% summary_list.row do |row| %>

2
app/frontend/application.js

@ -13,7 +13,7 @@ import 'regenerator-runtime/runtime'
// //
import { initAll as GOVUKFrontend } from 'govuk-frontend' import { initAll as GOVUKFrontend } from 'govuk-frontend'
import { initAll as GOVUKPrototypeComponents } from 'govuk-prototype-components' import { initAll as GOVUKPrototypeComponents } from '@x-govuk/govuk-prototype-components'
import './controllers' import './controllers'
import './cookie-banner' import './cookie-banner'
import './styles/application.scss' import './styles/application.scss'

2
app/frontend/controllers/govukfrontend_controller.js

@ -1,5 +1,5 @@
import { initAll as GOVUKFrontend } from 'govuk-frontend' import { initAll as GOVUKFrontend } from 'govuk-frontend'
import { initAll as GOVUKPrototypeComponents } from 'govuk-prototype-components' import { initAll as GOVUKPrototypeComponents } from '@x-govuk/govuk-prototype-components'
import { Controller } from '@hotwired/stimulus' import { Controller } from '@hotwired/stimulus'
export default class extends Controller { export default class extends Controller {

4
app/helpers/filters_helper.rb

@ -91,8 +91,8 @@ private
filters.each.sum do |category, category_filters| filters.each.sum do |category, category_filters|
if %w[status years bulk_upload_id].include?(category) if %w[status years bulk_upload_id].include?(category)
category_filters.count(&:present?) category_filters.count(&:present?)
elsif %w[assigned_to organisation].include?(category) elsif %w[user owning_organisation managing_organisation].include?(category)
category_filters != "all" ? 1 : 0 1
else else
0 0
end end

11
app/helpers/organisation_helper.rb

@ -1,11 +0,0 @@
module OrganisationHelper
def organisation_header(path, user, current_organisation)
if path == "/organisations"
"Organisations"
elsif user.organisation_id == current_organisation.id
"Your organisation"
else
current_organisation.name
end
end
end

40
app/helpers/organisations_helper.rb

@ -0,0 +1,40 @@
module OrganisationsHelper
def organisation_header(path, user, current_organisation)
if path == "/organisations"
"Organisations"
elsif user.organisation_id == current_organisation.id
"Your organisation"
else
current_organisation.name
end
end
def display_organisation_attributes(organisation)
[
{ name: "Organisation ID", value: "ORG#{organisation.id}", editable: false },
{ name: "Address", value: organisation.address_string, editable: true },
{ name: "Telephone number", value: organisation.phone, editable: true },
{ name: "Type of provider", value: organisation.display_provider_type, editable: false },
{ name: "Registration number", value: organisation.housing_registration_no || "", editable: false },
{ name: "Rent periods", value: organisation.rent_period_labels, editable: false, format: :bullet },
{ name: "Owns housing stock", value: organisation.holds_own_stock ? "Yes" : "No", editable: false },
{ name: "Status", value: status_tag(organisation.status), editable: false },
]
end
def organisation_name_row(user:, organisation:, summary_list:)
summary_list.row do |row|
row.key { "Name" }
row.value { organisation.name }
if user.support?
row.action(
visually_hidden_text: organisation.name.humanize.downcase,
href: edit_organisation_path(organisation),
html_attributes: { "data-qa": "change-#{organisation.name.downcase}" },
)
else
row.action
end
end
end
end

2
app/helpers/tag_helper.rb

@ -13,6 +13,7 @@ module TagHelper
reactivating_soon: "Reactivating soon", reactivating_soon: "Reactivating soon",
deactivated: "Deactivated", deactivated: "Deactivated",
deleted: "Deleted", deleted: "Deleted",
merged: "Merged",
}.freeze }.freeze
COLOUR = { COLOUR = {
@ -27,6 +28,7 @@ module TagHelper
reactivating_soon: "blue", reactivating_soon: "blue",
deactivated: "grey", deactivated: "grey",
deleted: "red", deleted: "red",
merged: "orange",
}.freeze }.freeze
def status_tag(status, classes = []) def status_tag(status, classes = [])

23
app/models/organisation.rb

@ -102,19 +102,6 @@ class Organisation < ApplicationRecord
DISPLAY_PROVIDER_TYPE[provider_type.to_sym] DISPLAY_PROVIDER_TYPE[provider_type.to_sym]
end end
def display_organisation_attributes
[
{ name: "Name", value: name, editable: true },
{ name: "Organisation ID", value: "ORG#{id}", editable: false },
{ name: "Address", value: address_string, editable: true },
{ name: "Telephone number", value: phone, editable: true },
{ name: "Type of provider", value: display_provider_type, editable: false },
{ name: "Registration number", value: housing_registration_no || "", editable: false },
{ name: "Rent periods", value: rent_period_labels, editable: false, format: :bullet },
{ name: "Owns housing stock", value: holds_own_stock ? "Yes" : "No", editable: false },
]
end
def has_managing_agents? def has_managing_agents?
managing_agents.count.positive? managing_agents.count.positive?
end end
@ -122,4 +109,14 @@ class Organisation < ApplicationRecord
def has_stock_owners? def has_stock_owners?
stock_owners.count.positive? stock_owners.count.positive?
end end
def status
@status ||= status_at(Time.zone.now)
end
def status_at(date)
return :merged if merge_date.present? && merge_date < date
:active
end
end end

7
app/models/user.rb

@ -24,6 +24,7 @@ class User < ApplicationRecord
after_validation :send_data_protection_confirmation_reminder, if: :is_dpo_changed? after_validation :send_data_protection_confirmation_reminder, if: :is_dpo_changed?
validates :organisation_id, presence: true validates :organisation_id, presence: true
validate :organisation_not_merged
has_paper_trail ignore: %w[last_sign_in_at has_paper_trail ignore: %w[last_sign_in_at
current_sign_in_at current_sign_in_at
@ -185,6 +186,12 @@ protected
private private
def organisation_not_merged
if organisation&.merge_date.present? && organisation.merge_date < Time.zone.now
errors.add :organisation_id, I18n.t("validations.organisation.merged")
end
end
def send_data_protection_confirmation_reminder def send_data_protection_confirmation_reminder
return unless persisted? return unless persisted?
return unless is_dpo? return unless is_dpo?

6
app/models/validations/household_validations.rb

@ -60,9 +60,9 @@ module Validations::HouseholdValidations
record.errors.add :prevten, :non_temp_accommodation, message: I18n.t("validations.household.prevten.non_temp_accommodation") record.errors.add :prevten, :non_temp_accommodation, message: I18n.t("validations.household.prevten.non_temp_accommodation")
end end
if record.age1.present? && record.age1 > 19 && record.previous_tenancy_was_foster_care? if record.age1.present? && record.age1 > 25 && record.previous_tenancy_was_foster_care?
record.errors.add :prevten, :over_20_foster_care, message: I18n.t("validations.household.prevten.over_20_foster_care") record.errors.add :prevten, :over_25_foster_care, message: I18n.t("validations.household.prevten.over_25_foster_care")
record.errors.add :age1, I18n.t("validations.household.age.lead.over_20") record.errors.add :age1, I18n.t("validations.household.age.lead.over_25")
end end
if record.sex1 == "M" && record.previous_tenancy_was_refuge? if record.sex1 == "M" && record.previous_tenancy_was_refuge?

2
app/services/exports/lettings_log_export_constants.rb

@ -20,7 +20,9 @@ module Exports::LettingsLogExportConstants
"cligrp1", "cligrp1",
"cligrp2", "cligrp2",
"createddate", # New metadata coming from our system "createddate", # New metadata coming from our system
"creation_method",
"confidential", "confidential",
"discarded_at",
"earnings", "earnings",
"ethnic", "ethnic",
"formid", "formid",

2
app/services/imports/lettings_logs_import_service.rb

@ -300,7 +300,7 @@ module Imports
%i[referral internal_transfer_non_social_housing] => %w[referral], %i[referral internal_transfer_non_social_housing] => %w[referral],
%i[referral internal_transfer_fixed_or_lifetime] => %w[referral], %i[referral internal_transfer_fixed_or_lifetime] => %w[referral],
%i[tenancylength tenancylength_invalid] => %w[tenancylength tenancy], %i[tenancylength tenancylength_invalid] => %w[tenancylength tenancy],
%i[prevten over_20_foster_care] => %w[prevten age1], %i[prevten over_25_foster_care] => %w[prevten age1],
%i[prevten non_temp_accommodation] => %w[prevten rsnvac], %i[prevten non_temp_accommodation] => %w[prevten rsnvac],
%i[joint not_joint_tenancy] => %w[joint], %i[joint not_joint_tenancy] => %w[joint],
%i[offered outside_the_range] => %w[offered], %i[offered outside_the_range] => %w[offered],

4
app/views/form/_interruption_screen_question.html.erb

@ -3,8 +3,8 @@
<h1 class="govuk-heading-m"> <h1 class="govuk-heading-m">
Make sure these answers are correct: Make sure these answers are correct:
</h1> </h1>
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> <div class="govuk-summary-card govuk-!-margin-bottom-6">
<div class="x-govuk-summary-card__body"> <div class="govuk-summary-card__content">
<%= render partial: "form/check_answers_summary_list", locals: { <%= render partial: "form/check_answers_summary_list", locals: {
lettings_log:, lettings_log:,

8
app/views/form/review.html.erb

@ -14,11 +14,11 @@
<h2 class="govuk-heading-m"><%= section.label %></h2> <h2 class="govuk-heading-m"><%= section.label %></h2>
<% section.subsections.map do |subsection| %> <% section.subsections.map do |subsection| %>
<% if total_applicable_questions(subsection, @log, current_user).any? %> <% if total_applicable_questions(subsection, @log, current_user).any? %>
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> <div class="govuk-summary-card govuk-!-margin-bottom-6">
<div class="x-govuk-summary-card__header"> <div class="govuk-summary-card__title-wrapper">
<h3 class="x-govuk-summary-card__title"><%= subsection.label %></h3> <h3 class="govuk-summary-card__title"><%= subsection.label %></h3>
</div> </div>
<div class="x-govuk-summary-card__body"> <div class="govuk-summary-card__content">
<%= render partial: "form/check_answers_summary_list", locals: { subsection:, questions: total_applicable_questions(subsection, @log, current_user), referrer: "check_answers" } %> <%= render partial: "form/check_answers_summary_list", locals: { subsection:, questions: total_applicable_questions(subsection, @log, current_user), referrer: "check_answers" } %>
</div> </div>
</div> </div>

4
app/views/organisations/_organisation_list.html.erb

@ -14,6 +14,9 @@
<% row.cell(header: true, text: "Type", html_attributes: { <% row.cell(header: true, text: "Type", html_attributes: {
scope: "col", scope: "col",
}) %> }) %>
<% row.cell(header: true, text: "Status", html_attributes: {
scope: "col",
}) %>
<% end %> <% end %>
<% end %> <% end %>
<% @organisations.each do |organisation| %> <% @organisations.each do |organisation| %>
@ -26,6 +29,7 @@
<% end %> <% end %>
<% row.cell(text: organisation.housing_registration_no) %> <% row.cell(text: organisation.housing_registration_no) %>
<% row.cell(text: organisation.display_provider_type) %> <% row.cell(text: organisation.display_provider_type) %>
<% row.cell(text: status_tag(organisation.status)) %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

5
app/views/organisations/edit.html.erb

@ -11,8 +11,9 @@
<%= content_for(:title) %> <%= content_for(:title) %>
</h1> </h1>
<%= f.govuk_text_field :name, <% if current_user.support? %>
autocomplete: "name" %> <%= f.govuk_text_field :name, autocomplete: "name" %>
<% end %>
<%= f.govuk_text_field :address_line1, <%= f.govuk_text_field :address_line1,
label: { text: "Address line 1" }, label: { text: "Address line 1" },

3
app/views/organisations/show.html.erb

@ -14,7 +14,8 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% @organisation.display_organisation_attributes.each do |attr| %> <%= organisation_name_row(user: current_user, organisation: @organisation, summary_list:) %>
<% display_organisation_attributes(@organisation).each do |attr| %>
<% if can_edit_org?(current_user) && attr[:editable] %> <% if can_edit_org?(current_user) && attr[:editable] %>
<%= summary_list.row do |row| %> <%= summary_list.row do |row| %>
<% row.key { attr[:name] } %> <% row.key { attr[:name] } %>

2
config/cloud_foundry/review_manifest.yml

@ -1,7 +1,7 @@
--- ---
defaults: &defaults defaults: &defaults
buildpacks: buildpacks:
- https://github.com/cloudfoundry/ruby-buildpack.git#v1.8.59 - https://github.com/cloudfoundry/ruby-buildpack.git
processes: processes:
- type: web - type: web
command: bundle exec rake cf:on_first_instance db:migrate db:seed && bin/rails server command: bundle exec rake cf:on_first_instance db:migrate db:seed && bin/rails server

5
config/locales/en.yml

@ -198,6 +198,7 @@ en:
managing_agent: managing_agent:
blank: "You must choose a managing agent" blank: "You must choose a managing agent"
already_added: "You have already added this managing agent" already_added: "You have already added this managing agent"
merged: "That organisation has already been merged. Select a different organisation."
not_answered: "You must answer %{question}" not_answered: "You must answer %{question}"
invalid_option: "Enter a valid value for %{question}" invalid_option: "Enter a valid value for %{question}"
invalid_number: "Enter a number for %{question}" invalid_number: "Enter a number for %{question}"
@ -441,7 +442,7 @@ en:
must_be_16_19: "Person must be aged 16-19 if they are a student and have relationship ‘child’" must_be_16_19: "Person must be aged 16-19 if they are a student and have relationship ‘child’"
partner_under_16: "Cannot be under 16 if the relationship is partner" partner_under_16: "Cannot be under 16 if the relationship is partner"
lead: lead:
over_20: "The lead tenant must be under 20 as you told us their housing situation immediately before this letting was a children’s home or foster care" over_25: "The lead tenant must be under 26 as you told us their housing situation immediately before this letting was a children’s home or foster care"
ecstat: ecstat:
retired_over_70: "Person %{person_num} must be retired if over 70" retired_over_70: "Person %{person_num} must be retired if over 70"
child_under_16: "Person %{person_num}’s working situation must be ‘child under 16’ as you told us they’re under 16" child_under_16: "Person %{person_num}’s working situation must be ‘child under 16’ as you told us they’re under 16"
@ -475,7 +476,7 @@ en:
no_and_dont_know_disabled_needs_conjunction: "No disabled access needs and don’t know disabled access needs cannot be selected together" no_and_dont_know_disabled_needs_conjunction: "No disabled access needs and don’t know disabled access needs cannot be selected together"
prevten: prevten:
non_temp_accommodation: "Answer cannot be non-temporary accommodation as this is a re-let to a tenant who occupied the same property as temporary accommodation" non_temp_accommodation: "Answer cannot be non-temporary accommodation as this is a re-let to a tenant who occupied the same property as temporary accommodation"
over_20_foster_care: "Answer cannot be a children’s home or foster care as the lead tenant is 20 or older" over_25_foster_care: "Answer cannot be a children’s home or foster care as the lead tenant is 26 or older"
male_refuge: "Answer cannot be a refuge as the lead tenant identifies as male" male_refuge: "Answer cannot be a refuge as the lead tenant identifies as male"
internal_transfer: "Answer cannot be %{prevten} as this tenancy is an internal transfer" internal_transfer: "Answer cannot be %{prevten} as this tenancy is an internal transfer"
la_general_needs: la_general_needs:

5
db/migrate/20230718151955_add_merge_date_to_organisation.rb

@ -0,0 +1,5 @@
class AddMergeDateToOrganisation < ActiveRecord::Migration[7.0]
def change
add_column :organisations, :merge_date, :datetime
end
end

29
db/schema.rb

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do ActiveRecord::Schema[7.0].define(version: 2023_07_18_151955) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -192,14 +192,14 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
t.integer "hb" t.integer "hb"
t.integer "hbrentshortfall" t.integer "hbrentshortfall"
t.integer "property_relet" t.integer "property_relet"
t.datetime "mrcdate", precision: nil t.datetime "mrcdate"
t.integer "incref" t.integer "incref"
t.datetime "startdate", precision: nil t.datetime "startdate"
t.integer "armedforces" t.integer "armedforces"
t.integer "first_time_property_let_as_social_housing" t.integer "first_time_property_let_as_social_housing"
t.integer "unitletas" t.integer "unitletas"
t.integer "builtype" t.integer "builtype"
t.datetime "voiddate", precision: nil t.datetime "voiddate"
t.bigint "owning_organisation_id" t.bigint "owning_organisation_id"
t.bigint "managing_organisation_id" t.bigint "managing_organisation_id"
t.integer "renttype" t.integer "renttype"
@ -347,7 +347,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
t.string "old_id" t.string "old_id"
t.string "old_visible_id" t.string "old_visible_id"
t.string "mobility_type" t.string "mobility_type"
t.datetime "startdate", precision: nil t.datetime "startdate"
t.string "location_admin_district" t.string "location_admin_district"
t.boolean "confirmed" t.boolean "confirmed"
t.index ["old_id"], name: "index_locations_on_old_id", unique: true t.index ["old_id"], name: "index_locations_on_old_id", unique: true
@ -433,6 +433,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
t.integer "unspecified_units" t.integer "unspecified_units"
t.string "old_org_id" t.string "old_org_id"
t.string "old_visible_id" t.string "old_visible_id"
t.datetime "merge_date"
t.index ["old_visible_id"], name: "index_organisations_on_old_visible_id", unique: true t.index ["old_visible_id"], name: "index_organisations_on_old_visible_id", unique: true
end end
@ -518,7 +519,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
t.integer "stairbought" t.integer "stairbought"
t.integer "stairowned" t.integer "stairowned"
t.decimal "mrent", precision: 10, scale: 2 t.decimal "mrent", precision: 10, scale: 2
t.datetime "exdate", precision: nil t.datetime "exdate"
t.integer "exday" t.integer "exday"
t.integer "exmonth" t.integer "exmonth"
t.integer "exyear" t.integer "exyear"
@ -554,7 +555,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
t.integer "wchair" t.integer "wchair"
t.integer "income2_value_check" t.integer "income2_value_check"
t.integer "armedforcesspouse" t.integer "armedforcesspouse"
t.datetime "hodate", precision: nil t.datetime "hodate"
t.integer "hoday" t.integer "hoday"
t.integer "homonth" t.integer "homonth"
t.integer "hoyear" t.integer "hoyear"
@ -607,9 +608,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
t.integer "discounted_sale_value_check" t.integer "discounted_sale_value_check"
t.integer "student_not_child_value_check" t.integer "student_not_child_value_check"
t.integer "percentage_discount_value_check" t.integer "percentage_discount_value_check"
t.integer "combined_income_value_check"
t.integer "buyer_livein_value_check" t.integer "buyer_livein_value_check"
t.integer "status_cache", default: 0, null: false t.integer "status_cache", default: 0, null: false
t.integer "combined_income_value_check"
t.datetime "discarded_at" t.datetime "discarded_at"
t.integer "stairowned_value_check" t.integer "stairowned_value_check"
t.integer "creation_method", default: 1 t.integer "creation_method", default: 1
@ -662,8 +663,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
t.string "name" t.string "name"
t.bigint "organisation_id" t.bigint "organisation_id"
t.integer "sign_in_count", default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at", precision: nil t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at", precision: nil t.datetime "last_sign_in_at"
t.string "current_sign_in_ip" t.string "current_sign_in_ip"
t.string "last_sign_in_ip" t.string "last_sign_in_ip"
t.integer "role" t.integer "role"
@ -671,7 +672,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
t.string "phone" t.string "phone"
t.integer "failed_attempts", default: 0 t.integer "failed_attempts", default: 0
t.string "unlock_token" t.string "unlock_token"
t.datetime "locked_at", precision: nil t.datetime "locked_at"
t.boolean "is_dpo", default: false t.boolean "is_dpo", default: false
t.boolean "is_key_contact", default: false t.boolean "is_key_contact", default: false
t.integer "second_factor_attempts_count", default: 0 t.integer "second_factor_attempts_count", default: 0
@ -679,12 +680,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
t.string "encrypted_otp_secret_key_iv" t.string "encrypted_otp_secret_key_iv"
t.string "encrypted_otp_secret_key_salt" t.string "encrypted_otp_secret_key_salt"
t.string "direct_otp" t.string "direct_otp"
t.datetime "direct_otp_sent_at", precision: nil t.datetime "direct_otp_sent_at"
t.datetime "totp_timestamp", precision: nil t.datetime "totp_timestamp", precision: nil
t.boolean "active", default: true t.boolean "active", default: true
t.string "confirmation_token" t.string "confirmation_token"
t.datetime "confirmed_at", precision: nil t.datetime "confirmed_at"
t.datetime "confirmation_sent_at", precision: nil t.datetime "confirmation_sent_at"
t.string "unconfirmed_email" t.string "unconfirmed_email"
t.boolean "initial_confirmation_sent" t.boolean "initial_confirmation_sent"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true

4
docs/setup.md

@ -64,8 +64,8 @@ We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS version
4. Install Ruby and Bundler 4. Install Ruby and Bundler
```bash ```bash
rbenv install 3.1.2 rbenv install 3.1.4
rbenv global 3.1.2 rbenv global 3.1.4
source ~/.bashrc source ~/.bashrc
gem install bundler gem install bundler
``` ```

2
manifest.yml

@ -1,7 +1,7 @@
--- ---
defaults: &defaults defaults: &defaults
buildpacks: buildpacks:
- https://github.com/cloudfoundry/ruby-buildpack.git#v1.8.59 - https://github.com/cloudfoundry/ruby-buildpack.git
processes: processes:
- type: web - type: web
command: bundle exec rake cf:on_first_instance db:migrate && bin/rails server command: bundle exec rake cf:on_first_instance db:migrate && bin/rails server

6
package.json

@ -2,7 +2,7 @@
"name": "data-collector", "name": "data-collector",
"private": true, "private": true,
"engines": { "engines": {
"node": "^16.0.0" "node": "^18.0.0"
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.17.7", "@babel/core": "^7.17.7",
@ -11,6 +11,7 @@
"@hotwired/stimulus": "^3.0.0", "@hotwired/stimulus": "^3.0.0",
"@stimulus/polyfills": "^2.0.0", "@stimulus/polyfills": "^2.0.0",
"@webcomponents/webcomponentsjs": "^2.6.0", "@webcomponents/webcomponentsjs": "^2.6.0",
"@x-govuk/govuk-prototype-components": "^2.0.1",
"accessible-autocomplete": "^2.0.3", "accessible-autocomplete": "^2.0.3",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"babel-plugin-macros": "^3.1.0", "babel-plugin-macros": "^3.1.0",
@ -19,8 +20,7 @@
"css-loader": "^6.7.1", "css-loader": "^6.7.1",
"custom-event-polyfill": "^1.0.7", "custom-event-polyfill": "^1.0.7",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"govuk-frontend": "4.2.0", "govuk-frontend": "4.7.0",
"govuk-prototype-components": "^0.4.0",
"html5shiv": "^3.7.3", "html5shiv": "^3.7.3",
"intersection-observer": "^0.12.0", "intersection-observer": "^0.12.0",
"mini-css-extract-plugin": "^2.6.0", "mini-css-extract-plugin": "^2.6.0",

6
spec/features/form/check_answers_page_lettings_logs_spec.rb

@ -148,14 +148,14 @@ RSpec.describe "Lettings Log Check Answers Page" do
it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do
visit("/lettings-logs/#{completed_lettings_log.id}/household-needs/check-answers") visit("/lettings-logs/#{completed_lettings_log.id}/household-needs/check-answers")
assert_selector ".x-govuk-summary-card__title", count: 0 assert_selector ".govuk-summary-card__title", count: 0
end end
context "when the user is checking their answers for the household characteristics subsection" do context "when the user is checking their answers for the household characteristics subsection" do
it "they see a separate summary card for each member of the household" do it "they see a separate summary card for each member of the household" do
visit("/lettings-logs/#{completed_lettings_log.id}/#{subsection}/check-answers") visit("/lettings-logs/#{completed_lettings_log.id}/#{subsection}/check-answers")
assert_selector ".x-govuk-summary-card__title", text: "Lead tenant", count: 1 assert_selector ".govuk-summary-card__title", text: "Lead tenant", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 2", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 2", count: 1
end end
end end

30
spec/features/form/check_answers_page_sales_logs_spec.rb

@ -36,33 +36,33 @@ RSpec.describe "Sales Log Check Answers Page" do
it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do
visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/household-needs/check-answers") visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/household-needs/check-answers")
assert_selector ".x-govuk-summary-card__title", count: 0 assert_selector ".govuk-summary-card__title", count: 0
end end
context "when the user is checking their answers for the household characteristics subsection" do context "when the user is checking their answers for the household characteristics subsection" do
context "and the log is for a joint purchase" do context "and the log is for a joint purchase" do
it "they see a separate summary card for each member of the household" do it "they see a separate summary card for each member of the household" do
visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/#{subsection}/check-answers") visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/#{subsection}/check-answers")
assert_selector ".x-govuk-summary-card__title", text: "Buyer 1", count: 1 assert_selector ".govuk-summary-card__title", text: "Buyer 1", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Buyer 2", count: 1 assert_selector ".govuk-summary-card__title", text: "Buyer 2", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 1", count: 0 assert_selector ".govuk-summary-card__title", text: "Person 1", count: 0
assert_selector ".x-govuk-summary-card__title", text: "Person 2", count: 0 assert_selector ".govuk-summary-card__title", text: "Person 2", count: 0
assert_selector ".x-govuk-summary-card__title", text: "Person 3", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 3", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 4", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 4", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 5", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 5", count: 1
end end
end end
context "and the log is for a non-joint purchase" do context "and the log is for a non-joint purchase" do
it "they see a separate summary card for each member of the household" do it "they see a separate summary card for each member of the household" do
visit("/sales-logs/#{completed_sales_log_non_joint_purchase.id}/#{subsection}/check-answers") visit("/sales-logs/#{completed_sales_log_non_joint_purchase.id}/#{subsection}/check-answers")
assert_selector ".x-govuk-summary-card__title", text: "Buyer 1", count: 1 assert_selector ".govuk-summary-card__title", text: "Buyer 1", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Buyer 2", count: 0 assert_selector ".govuk-summary-card__title", text: "Buyer 2", count: 0
assert_selector ".x-govuk-summary-card__title", text: "Person 1", count: 0 assert_selector ".govuk-summary-card__title", text: "Person 1", count: 0
assert_selector ".x-govuk-summary-card__title", text: "Person 2", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 2", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 3", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 3", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 4", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 4", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 5", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 5", count: 1
end end
end end
end end

14
spec/features/lettings_log_spec.rb

@ -59,9 +59,17 @@ RSpec.describe "Lettings Log Features" do
context "when filtering logs" do context "when filtering logs" do
let(:user) { create(:user, last_sign_in_at: Time.zone.now) } let(:user) { create(:user, last_sign_in_at: Time.zone.now) }
let(:stock_owner_1) { create(:organisation, name: "stock owner 1") }
let(:stock_owner_2) { create(:organisation, name: "stock owner 2") }
let(:managing_agent_1) { create(:organisation, name: "managing agent 1") }
let(:managing_agent_2) { create(:organisation, name: "managing agent 2") }
context "when I am signed in" do context "when I am signed in" do
before do before do
FactoryBot.create(:organisation_relationship, child_organisation: user.organisation, parent_organisation: stock_owner_1)
FactoryBot.create(:organisation_relationship, child_organisation: user.organisation, parent_organisation: stock_owner_2)
FactoryBot.create(:organisation_relationship, child_organisation: managing_agent_1, parent_organisation: user.organisation)
FactoryBot.create(:organisation_relationship, child_organisation: managing_agent_2, parent_organisation: user.organisation)
visit("/lettings-logs") visit("/lettings-logs")
fill_in("user[email]", with: user.email) fill_in("user[email]", with: user.email)
fill_in("user[password]", with: user.password) fill_in("user[password]", with: user.password)
@ -80,11 +88,15 @@ RSpec.describe "Lettings Log Features" do
check("Not started") check("Not started")
check("In progress") check("In progress")
choose("You") choose("You")
choose("Specific owning organisation")
select(stock_owner_1.name, from: "owning_organisation")
choose("Specific managing organisation")
select(managing_agent_1.name, from: "managing_organisation")
click_button("Apply filters") click_button("Apply filters")
end end
it "displays the filters component with a correct count and clear button" do it "displays the filters component with a correct count and clear button" do
expect(page).to have_content("3 filters applied") expect(page).to have_content("5 filters applied")
expect(page).to have_content("Clear") expect(page).to have_content("Clear")
end end

2
spec/fixtures/exports/general_needs_log.xml vendored

@ -142,6 +142,8 @@
<address_line2/> <address_line2/>
<town_or_city>London</town_or_city> <town_or_city>London</town_or_city>
<county/> <county/>
<discarded_at/>
<creation_method>1</creation_method>
<formid>{id}</formid> <formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid> <owningorgid>{owning_org_id}</owningorgid>
<owningorgname>DLUHC</owningorgname> <owningorgname>DLUHC</owningorgname>

2
spec/fixtures/exports/general_needs_log_23_24.xml vendored

@ -143,6 +143,8 @@
<address_line2/> <address_line2/>
<town_or_city>London</town_or_city> <town_or_city>London</town_or_city>
<county/> <county/>
<discarded_at/>
<creation_method>1</creation_method>
<formid>{id}</formid> <formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid> <owningorgid>{owning_org_id}</owningorgid>
<owningorgname>DLUHC</owningorgname> <owningorgname>DLUHC</owningorgname>

2
spec/fixtures/exports/supported_housing_logs.xml vendored

@ -141,6 +141,8 @@
<address_line2/> <address_line2/>
<town_or_city/> <town_or_city/>
<county/> <county/>
<discarded_at/>
<creation_method>1</creation_method>
<formid>{id}</formid> <formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid> <owningorgid>{owning_org_id}</owningorgid>
<owningorgname>DLUHC</owningorgname> <owningorgname>DLUHC</owningorgname>

5
spec/helpers/filters_helper_spec.rb

@ -222,7 +222,7 @@ RSpec.describe FiltersHelper do
"assigned_to" => "all", "assigned_to" => "all",
"status" => [""], "status" => [""],
"years" => [""], "years" => [""],
"organisation" => "all", "organisation_select" => "all",
} }
end end
@ -237,7 +237,8 @@ RSpec.describe FiltersHelper do
"assigned_to" => "all", "assigned_to" => "all",
"status" => %w[in_progress completed], "status" => %w[in_progress completed],
"years" => [""], "years" => [""],
"organisation" => 2, "organisation_select" => "specific_org",
"managing_organisation" => 2,
} }
end end

23
spec/helpers/organisations_helper_spec.rb

@ -0,0 +1,23 @@
require "rails_helper"
RSpec.describe OrganisationsHelper do
include TagHelper
describe "display_organisation_attributes" do
let(:organisation) { create(:organisation) }
it "does not include data protection agreement" do
expect(display_organisation_attributes(organisation)).to eq(
[{ editable: false, name: "Organisation ID", value: "ORG#{organisation.id}" },
{ editable: true,
name: "Address",
value: "2 Marsham Street\nLondon\nSW1P 4DF" },
{ editable: true, name: "Telephone number", value: nil },
{ editable: false, name: "Type of provider", value: "Local authority" },
{ editable: false, name: "Registration number", value: "1234" },
{ editable: false, format: :bullet, name: "Rent periods", value: %w[All] },
{ editable: false, name: "Owns housing stock", value: "Yes" },
{ editable: false, name: "Status", value: status_tag(organisation.status) }],
)
end
end
end

1
spec/helpers/tag_helper_spec.rb

@ -20,6 +20,7 @@ RSpec.describe TagHelper do
expect(status_tag("activating_soon", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--blue app-tag--small\">Activating soon</strong>") expect(status_tag("activating_soon", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--blue app-tag--small\">Activating soon</strong>")
expect(status_tag("reactivating_soon", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--blue app-tag--small\">Reactivating soon</strong>") expect(status_tag("reactivating_soon", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--blue app-tag--small\">Reactivating soon</strong>")
expect(status_tag("deactivated", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Deactivated</strong>") expect(status_tag("deactivated", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Deactivated</strong>")
expect(status_tag("merged", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--orange app-tag--small\">Merged</strong>")
end end
end end
end end

19
spec/models/organisation_spec.rb

@ -230,23 +230,4 @@ RSpec.describe Organisation, type: :model do
end end
end end
end end
describe "display_organisation_attributes" do
let(:organisation) { create(:organisation) }
it "does not include data protection agreement" do
expect(organisation.display_organisation_attributes).to eq(
[{ editable: true, name: "Name", value: "DLUHC" },
{ editable: false, name: "Organisation ID", value: "ORG#{organisation.id}" },
{ editable: true,
name: "Address",
value: "2 Marsham Street\nLondon\nSW1P 4DF" },
{ editable: true, name: "Telephone number", value: nil },
{ editable: false, name: "Type of provider", value: "Local authority" },
{ editable: false, name: "Registration number", value: "1234" },
{ editable: false, format: :bullet, name: "Rent periods", value: %w[All] },
{ editable: false, name: "Owns housing stock", value: "Yes" }],
)
end
end
end end

10
spec/models/user_spec.rb

@ -334,6 +334,16 @@ RSpec.describe User, type: :model do
.to raise_error(ActiveRecord::RecordInvalid, error_message) .to raise_error(ActiveRecord::RecordInvalid, error_message)
end end
end end
context "when a user is added to a merged organisation" do
let(:merged_organisation) { create(:organisation, merge_date: Time.zone.yesterday) }
let(:error_message) { "Validation failed: Organisation #{I18n.t('validations.organisation.merged')}" }
it "validates organisation merge status" do
expect { create(:user, organisation: merged_organisation) }
.to raise_error(ActiveRecord::RecordInvalid, error_message)
end
end
end end
describe "delete" do describe "delete" do

8
spec/models/validations/household_validations_spec.rb

@ -624,15 +624,15 @@ RSpec.describe Validations::HouseholdValidations do
end end
end end
context "when the lead tenant is over 20" do context "when the lead tenant is over 25" do
it "cannot be children's home/foster care" do it "cannot be children's home/foster care" do
record.prevten = 13 record.prevten = 13
record.age1 = 21 record.age1 = 26
household_validator.validate_previous_housing_situation(record) household_validator.validate_previous_housing_situation(record)
expect(record.errors["prevten"]) expect(record.errors["prevten"])
.to include(match I18n.t("validations.household.prevten.over_20_foster_care")) .to include(match I18n.t("validations.household.prevten.over_25_foster_care"))
expect(record.errors["age1"]) expect(record.errors["age1"])
.to include(match I18n.t("validations.household.age.lead.over_20")) .to include(match I18n.t("validations.household.age.lead.over_25"))
end end
end end

8
spec/requests/organisations_controller_spec.rb

@ -262,9 +262,9 @@ RSpec.describe OrganisationsController, type: :request do
expect(response.body).to include(organisation.name) expect(response.body).to include(organisation.name)
end end
it "has a change details link" do it "does not include a change details link" do
expected_html = "data-qa=\"change-name\" href=\"/organisations/#{organisation.id}/edit\"" expected_html = "data-qa=\"change-name\" href=\"/organisations/#{organisation.id}/edit\""
expect(response.body).to include(expected_html) expect(response.body).not_to include(expected_html)
end end
it "displays a link to merge organisations" do it "displays a link to merge organisations" do
@ -345,9 +345,9 @@ RSpec.describe OrganisationsController, type: :request do
get "/organisations/#{organisation.id}/edit", headers:, params: {} get "/organisations/#{organisation.id}/edit", headers:, params: {}
end end
it "shows an edit form" do it "shows an edit form without name field" do
expect(response.body).to include("Change #{organisation.name}’s details") expect(response.body).to include("Change #{organisation.name}’s details")
expect(page).to have_field("organisation-name-field") expect(page).not_to have_field("organisation-name-field")
expect(page).to have_field("organisation-phone-field") expect(page).to have_field("organisation-phone-field")
end end
end end

4
spec/services/imports/lettings_logs_import_service_spec.rb

@ -252,11 +252,11 @@ RSpec.describe Imports::LettingsLogsImportService do
end end
end end
context "and an lead tenant must be under 20 if childrens home or foster care" do context "and an lead tenant must be under 26 if childrens home or foster care" do
before do before do
lettings_log_xml.at_xpath("//meta:status").content = "submitted" lettings_log_xml.at_xpath("//meta:status").content = "submitted"
lettings_log_xml.at_xpath("//xmlns:Q11").content = "13" lettings_log_xml.at_xpath("//xmlns:Q11").content = "13"
lettings_log_xml.at_xpath("//xmlns:P1Age").content = "22" lettings_log_xml.at_xpath("//xmlns:P1Age").content = "26"
end end
it "intercepts the relevant validation error" do it "intercepts the relevant validation error" do

2
spec/views/bulk_upload_lettings_results/show.html.erb_spec.rb

@ -16,7 +16,7 @@ RSpec.describe "bulk_upload_lettings_results/show.html.erb" do
fragment = Capybara::Node::Simple.new(rendered) fragment = Capybara::Node::Simple.new(rendered)
expect(fragment.find_css(".x-govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"]) expect(fragment.find_css(".govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"])
end end
end end

2
spec/views/bulk_upload_lettings_results/summary.html.erb_spec.rb

@ -16,7 +16,7 @@ RSpec.describe "bulk_upload_lettings_results/summary.html.erb" do
fragment = Capybara::Node::Simple.new(rendered) fragment = Capybara::Node::Simple.new(rendered)
expect(fragment.find_css(".x-govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"]) expect(fragment.find_css(".govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"])
end end
end end

2
spec/views/bulk_upload_sales_results/show.html.erb_spec.rb

@ -16,7 +16,7 @@ RSpec.describe "bulk_upload_sales_results/show.html.erb" do
fragment = Capybara::Node::Simple.new(rendered) fragment = Capybara::Node::Simple.new(rendered)
expect(fragment.find_css(".x-govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"]) expect(fragment.find_css(".govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"])
end end
end end

2
spec/views/bulk_upload_sales_results/summary.html.erb_spec.rb

@ -16,7 +16,7 @@ RSpec.describe "bulk_upload_sales_results/summary.html.erb" do
fragment = Capybara::Node::Simple.new(rendered) fragment = Capybara::Node::Simple.new(rendered)
expect(fragment.find_css(".x-govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"]) expect(fragment.find_css(".govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"])
end end
end end

2
webpack.config.js

@ -40,7 +40,7 @@ module.exports = {
resolve: { resolve: {
alias: { alias: {
'govuk-frontend-styles': path.resolve(__dirname, 'node_modules/govuk-frontend/govuk/all.scss'), 'govuk-frontend-styles': path.resolve(__dirname, 'node_modules/govuk-frontend/govuk/all.scss'),
'govuk-prototype-styles': path.resolve(__dirname, 'node_modules/govuk-prototype-components/x-govuk/all.scss') 'govuk-prototype-styles': path.resolve(__dirname, 'node_modules/@x-govuk/govuk-prototype-components/x-govuk/all.scss')
}, },
modules: ['node_modules', 'node_modules/govuk-frontend/govuk'] modules: ['node_modules', 'node_modules/govuk-frontend/govuk']
}, },

2138
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save