Skip to content

Commit

Permalink
Change /organisations to /schools in claims
Browse files Browse the repository at this point in the history
In the claims domain, we don’t have the concept of a provider
so we should just use the /schools for route/controller
  • Loading branch information
CatalinVoineag committed Jan 2, 2024
1 parent 235e8d3 commit dc3a036
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
5 changes: 0 additions & 5 deletions app/controllers/claims/organisations_controller.rb

This file was deleted.

5 changes: 5 additions & 0 deletions app/controllers/claims/schools_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Claims::SchoolsController < ApplicationController
def index
@schools = current_user.schools
end
end
2 changes: 1 addition & 1 deletion app/helpers/routes_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion config/routes/claims.rb
Original file line number Diff line number Diff line change
@@ -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
18 changes: 9 additions & 9 deletions spec/system/claims/view_organisations_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit dc3a036

Please sign in to comment.