From 964cd2742e7aa100d7a9ba0d561d64b30c159646 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Wed, 28 Jun 2023 10:51:06 +0100 Subject: [PATCH] CLDC-2471 Add org id to about your org page (#1715) * feat: add org id to about page and update tests * refactor: tidying * feat: just enforce names are strings adn remove humanization to display ID in caps as required * refactor: lint * feat: fix tests --- app/models/organisation.rb | 5 +++-- app/views/organisations/show.html.erb | 4 ++-- spec/models/organisation_spec.rb | 10 ++++++---- spec/requests/delete_logs_controller_spec.rb | 12 ++++++------ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/models/organisation.rb b/app/models/organisation.rb index 150f3c69b..69aa59c97 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -105,11 +105,12 @@ class Organisation < ApplicationRecord def display_organisation_attributes attrs = [ { 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: "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: "Rent periods", value: rent_period_labels, editable: false, format: :bullet }, { name: "Owns housing stock", value: holds_own_stock ? "Yes" : "No", editable: false }, ].compact diff --git a/app/views/organisations/show.html.erb b/app/views/organisations/show.html.erb index f1afb275c..e39338651 100644 --- a/app/views/organisations/show.html.erb +++ b/app/views/organisations/show.html.erb @@ -17,7 +17,7 @@ <% @organisation.display_organisation_attributes.each do |attr| %> <% if can_edit_org?(current_user) && attr[:editable] %> <%= summary_list.row do |row| %> - <% row.key { attr[:name].to_s.humanize } %> + <% row.key { attr[:name] } %> <% row.value { details_html(attr) } %> <% row.action( visually_hidden_text: attr[:name].to_s.humanize.downcase, @@ -27,7 +27,7 @@ <% end %> <% else %> <%= summary_list.row do |row| %> - <% row.key { attr[:name].to_s.humanize } %> + <% row.key { attr[:name] } %> <% row.value { details_html(attr) } %> <% row.action %> <% end %> diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index e52317065..1b0567a0f 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -242,13 +242,14 @@ RSpec.describe Organisation, type: :model do 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: 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, format: :bullet, name: "Rent periods", value: %w[All] }, { editable: false, name: "Owns housing stock", value: "Yes" }], ) end @@ -262,13 +263,14 @@ RSpec.describe Organisation, type: :model do it "includes 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: 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, format: :bullet, name: "Rent periods", value: %w[All] }, { editable: false, name: "Owns housing stock", value: "Yes" }, { editable: false, name: "Data protection agreement", value: "Accepted" }], ) diff --git a/spec/requests/delete_logs_controller_spec.rb b/spec/requests/delete_logs_controller_spec.rb index fd509d699..9a90a9d87 100644 --- a/spec/requests/delete_logs_controller_spec.rb +++ b/spec/requests/delete_logs_controller_spec.rb @@ -118,7 +118,7 @@ RSpec.describe "DeleteLogs", type: :request do end before do - post delete_logs_confirmation_lettings_logs_path, params: params + post delete_logs_confirmation_lettings_logs_path, params: end it "requires delete logs form data to be provided" do @@ -188,7 +188,7 @@ RSpec.describe "DeleteLogs", type: :request do end before do - post delete_logs_confirmation_lettings_logs_path, params: params + post delete_logs_confirmation_lettings_logs_path, params: end it "renders the list of logs table again" do @@ -358,7 +358,7 @@ RSpec.describe "DeleteLogs", type: :request do end before do - post delete_logs_confirmation_sales_logs_path, params: params + post delete_logs_confirmation_sales_logs_path, params: end it "requires delete logs form data to be provided" do @@ -428,7 +428,7 @@ RSpec.describe "DeleteLogs", type: :request do end before do - post delete_logs_confirmation_sales_logs_path, params: params + post delete_logs_confirmation_sales_logs_path, params: end it "renders the list of logs table again" do @@ -602,7 +602,7 @@ RSpec.describe "DeleteLogs", type: :request do end before do - post delete_lettings_logs_confirmation_organisation_path(id: organisation), params: params + post delete_lettings_logs_confirmation_organisation_path(id: organisation), params: end it "requires delete logs form data to be provided" do @@ -827,7 +827,7 @@ RSpec.describe "DeleteLogs", type: :request do end before do - post delete_sales_logs_confirmation_organisation_path(id: organisation), params: params + post delete_sales_logs_confirmation_organisation_path(id: organisation), params: end it "requires delete logs form data to be provided" do