From da68e2630d8dd9a553805f2b8141ddad2b7ab951 Mon Sep 17 00:00:00 2001 From: CatalinVoineag <11318084+CatalinVoineag@users.noreply.github.com> Date: Tue, 2 Jan 2024 14:23:44 +0000 Subject: [PATCH] Change `/organisations` to `/schools` in claims MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the claims domain, we don’t have the concept of a provider so we should just use the /schools for route/controller --- .../claims/organisations_controller.rb | 5 ----- app/controllers/claims/schools_controller.rb | 5 +++++ app/helpers/routes_helper.rb | 2 +- .../{organisations => schools}/index.html.erb | 0 config/routes/claims.rb | 2 +- spec/system/claims/view_organisations_spec.rb | 18 +++++++++--------- 6 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 app/controllers/claims/organisations_controller.rb create mode 100644 app/controllers/claims/schools_controller.rb rename app/views/claims/{organisations => schools}/index.html.erb (100%) diff --git a/app/controllers/claims/organisations_controller.rb b/app/controllers/claims/organisations_controller.rb deleted file mode 100644 index ca229cc8f..000000000 --- a/app/controllers/claims/organisations_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Claims::OrganisationsController < ApplicationController - def index - @schools = current_user.schools - end -end diff --git a/app/controllers/claims/schools_controller.rb b/app/controllers/claims/schools_controller.rb new file mode 100644 index 000000000..abd2bb8f2 --- /dev/null +++ b/app/controllers/claims/schools_controller.rb @@ -0,0 +1,5 @@ +class Claims::SchoolsController < ApplicationController + def index + @schools = current_user.schools + end +end diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb index 40d26aabc..646490cf7 100644 --- a/app/helpers/routes_helper.rb +++ b/app/helpers/routes_helper.rb @@ -15,7 +15,7 @@ def support_root_path def organisation_index_path { - claims: claims_organisations_path, + claims: claims_schools_path, placements: placements_organisations_path, }.fetch current_service end diff --git a/app/views/claims/organisations/index.html.erb b/app/views/claims/schools/index.html.erb similarity index 100% rename from app/views/claims/organisations/index.html.erb rename to app/views/claims/schools/index.html.erb diff --git a/config/routes/claims.rb b/config/routes/claims.rb index 13281ec60..8b7c78f2c 100644 --- a/config/routes/claims.rb +++ b/config/routes/claims.rb @@ -1,5 +1,5 @@ scope module: :claims, as: :claims, constraints: { host: ENV["CLAIMS_HOST"] } do root to: "pages#index" - resources :organisations, only: [:index] + resources :schools, only: [:index] end diff --git a/spec/system/claims/view_organisations_spec.rb b/spec/system/claims/view_organisations_spec.rb index 62b7f87fe..103406bc7 100644 --- a/spec/system/claims/view_organisations_spec.rb +++ b/spec/system/claims/view_organisations_spec.rb @@ -1,23 +1,23 @@ require "rails_helper" -RSpec.describe "View organisations", type: :system do +RSpec.describe "View schools", type: :system do around do |example| Capybara.app_host = "https://#{ENV["CLAIMS_HOST"]}" example.run Capybara.app_host = nil end - scenario "I sign in as persona Mary with multiple organistions" do + scenario "I sign in as persona Mary with multiple schools" do persona = given_the_claims_persona("Mary") - and_persona_has_multiple_organisations(persona) + and_persona_has_multiple_schools(persona) when_i_visit_claims_personas when_i_click_sign_in(persona) - i_can_see_a_list_marys_claims_organisations(persona) + i_can_see_a_list_marys_claims_schools(persona) end - scenario "I sign in as persona Anne with one organisation" do + scenario "I sign in as persona Anne with one school" do persona = given_the_claims_persona("Anne") - and_persona_has_one_organisation(persona) + and_persona_has_one_school(persona) when_i_visit_claims_personas when_i_click_sign_in(persona) i_am_redirected_to_the_root_path @@ -30,14 +30,14 @@ def given_the_claims_persona(persona_name) create(:persona, persona_name.downcase.to_sym, service: "claims") end -def and_persona_has_multiple_organisations(persona) +def and_persona_has_multiple_schools(persona) school1 = create(:school) school2 = create(:school) create(:membership, user: persona, organisation: school1) create(:membership, user: persona, organisation: school2) end -def and_persona_has_one_organisation(persona) +def and_persona_has_one_school(persona) create(:membership, user: persona, organisation: create(:school)) end @@ -49,7 +49,7 @@ def when_i_click_sign_in(persona) click_on "Sign In as #{persona.first_name}" end -def i_can_see_a_list_marys_claims_organisations(persona) +def i_can_see_a_list_marys_claims_schools(persona) expect(page).to have_content("Organisations") expect(page).to have_content(persona.schools.first.name) expect(page).to have_content(persona.schools.last.name)