Browse Source

CLDC-2054 Add request a merge page (#1519)

* Move and rename some tests

* Add a merge organisation link

* Add merge page

* Don't display a second nav bar for support

* Fix spacing

* fix spacing and typos
pull/1556/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
45addee279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/helpers/navigation_items_helper.rb
  2. 48
      app/views/organisations/merge.html.erb
  3. 3
      app/views/organisations/show.html.erb
  4. 4
      config/initializers/feature_toggle.rb
  5. 1
      config/routes.rb
  6. 27
      spec/features/organisation_spec.rb
  7. 35
      spec/requests/organisations_controller_spec.rb

2
app/helpers/navigation_items_helper.rb

@ -101,7 +101,7 @@ private
end
def subnav_details_path?(path)
path.include?("/organisations") && path.include?("/details")
path.include?("/organisations") && (path.include?("/details") || path.include?("/merge"))
end
def stock_owners_path?(path)

48
app/views/organisations/merge.html.erb

@ -0,0 +1,48 @@
<% content_for :before_content do %>
<% title = "Tell us if your organisation is merging" %>
<% content_for :title, title %>
<%= govuk_back_link href: organisation_path %>
<% end %>
<h2 class="govuk-heading-l">Tell us if your organisation is merging</h2>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<p class="govuk-body">
Use this service to tell us if your organisation is merging with one or more other organisations. You can also use it to tell us about past merges that have not yet been reported to CORE.
</p>
<h2 class="govuk-heading-m">Before you start</h2>
<p class="govuk-body">Regardless of the merge type, you’ll be asked for:</p>
<ul class="govuk-list govuk-list--bullet">
<li>the organisations merging in CORE</li>
<li>the merge type: for example one organisation absorbing the rest, or them all creating a new organisation</li>
<li>to confirm or update the telephone number</li>
<li>the merge date</li>
<li>if user email addresses will change with this merge</li>
</ul>
<h2 class="govuk-heading-m">If email addresses are changing</h2>
<%= 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. ") %>
<p class="govuk-body">
Users must have access to their old email address, so they can confirm their new one.
</p>
<h2 class="govuk-heading-m">If merging into a new organisation</h2>
<p class="govuk-body">You'll also be asked for the new organisation’s:</p>
<ul class="govuk-list govuk-list--bullet">
<li>name</li>
<li>address</li>
<li>telephone number</li>
<li>housing provider type</li>
<li>Regulator of Social Housing registration number</li>
<li>held stock details</li>
</ul>
<%= 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. " %>
<%= govuk_start_button(
text: "Start now",
href: "#",
) %>
</div>
</div>

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

@ -35,6 +35,9 @@
<% end %>
<% end %>
<% if FeatureToggle.merge_organisations_enabled? %>
<p>Is your organisation merging with another? <%= govuk_link_to "Let us know using this form", merge_organisation_path %></p>
<% end %>
</div>
<div class="govuk-grid-column-one-third-from-desktop">

4
config/initializers/feature_toggle.rb

@ -53,4 +53,8 @@ class FeatureToggle
def self.collection_2023_2024_year_enabled?
true
end
def self.merge_organisations_enabled?
!Rails.env.production?
end
end

1
config/routes.rb

@ -119,6 +119,7 @@ Rails.application.routes.draw do
get "managing-agents/remove", to: "organisation_relationships#remove_managing_agent"
post "managing-agents", to: "organisation_relationships#create_managing_agent"
delete "managing-agents", to: "organisation_relationships#delete_managing_agent"
get "merge", to: "organisations#merge"
end
end

27
spec/features/organisation_spec.rb

@ -40,7 +40,7 @@ RSpec.describe "User Features" do
expect(page).to have_current_path("/organisations/#{org_id}/details")
end
context "when the user is a coordinator and the organisation does not hold housing stock" do
context "and the organisation does not hold housing stock" do
before do
organisation.update(holds_own_stock: false)
end
@ -51,7 +51,7 @@ RSpec.describe "User Features" do
end
end
context "when the user is a coordinator and the organisation holds housing stock" do
context "and the organisation holds housing stock" do
before do
organisation.update(holds_own_stock: true)
end
@ -61,18 +61,6 @@ RSpec.describe "User Features" do
expect(page).to have_link("Schemes", href: "/schemes")
end
end
context "when the user is support and the organisation does not hold housing stock" do
before do
organisation.update!(holds_own_stock: false)
user.update!(role: "support")
end
it "does not show schemes in the primary or secondary navigation bar on the organisations page" do
visit("/organisations")
expect(page).not_to have_link("Schemes", href: "/schemes", count: 2)
end
end
end
context "when users are part of organisation" do
@ -321,5 +309,16 @@ RSpec.describe "User Features" do
end
end
end
context "and the organisation does not hold housing stock" do
before do
organisation.update!(holds_own_stock: false)
end
it "does not show schemes in the primary or secondary navigation bar on the organisations page" do
visit("/organisations")
expect(page).not_to have_link("Schemes", href: "/schemes", count: 2)
end
end
end
end

35
spec/requests/organisations_controller_spec.rb

@ -227,6 +227,11 @@ RSpec.describe OrganisationsController, type: :request do
expected_html = "data-qa=\"change-name\" href=\"/organisations/#{organisation.id}/edit\""
expect(response.body).to include(expected_html)
end
it "displays a link to merge organisations" do
expect(page).to have_content("Is your organisation merging with another?")
expect(page).to have_link("Let us know using this form", href: "/organisations/#{organisation.id}/merge")
end
end
context "with organisation that are not in scope for the user, i.e. that they do not belong to" do
@ -435,6 +440,36 @@ RSpec.describe OrganisationsController, type: :request do
expect { request }.not_to change(Organisation, :count)
end
end
describe "#merge" do
context "with an organisation that the user belongs to" do
before do
get "/organisations/#{organisation.id}/merge", headers:, params: {}
end
it "shows the correct content" do
expect(page).to have_content("Tell us if your organisation is merging")
end
it "has a correct back link" do
expect(page).to have_link("Back", href: "/organisations/#{organisation.id}")
end
it "has a correct start no button" do
expect(page).to have_link("Start now", href: "#")
end
end
context "with organisation that are not in scope for the user, i.e. that they do not belong to" do
before do
get "/organisations/#{unauthorised_organisation.id}/merge", headers:, params: {}
end
it "returns not found 404 from org details route" do
expect(response).to have_http_status(:not_found)
end
end
end
end
context "with a data provider user" do

Loading…
Cancel
Save