From f9a87ee7b964caae3980cd7bf52b60697b6713ce Mon Sep 17 00:00:00 2001 From: Nzakou Cedric Date: Tue, 2 Jan 2024 16:48:36 +0000 Subject: [PATCH] fix request changes --- app/assets/stylesheets/application.sass.scss | 3 +- app/components/navigation_bar.html.erb | 4 +- app/controllers/claims/pages_controller.rb | 2 +- app/helpers/navigation_bar_helper.rb | 4 +- app/views/claims/pages/index.html.erb | 18 +++--- spec/factories/gias_schools.rb | 2 +- .../sign_in_as_a_claims_user_persona_spec.rb | 20 ++----- spec/system/claims/pages/home_spec.rb | 7 +-- spec/system/claims/view_organisations_spec.rb | 47 ++++++++++----- spec/system/home_page_spec.rb | 5 -- .../placements/view_organisations_spec.rb | 58 +++++++++---------- 11 files changed, 89 insertions(+), 81 deletions(-) diff --git a/app/assets/stylesheets/application.sass.scss b/app/assets/stylesheets/application.sass.scss index 55dfe87edb..d1b524b340 100644 --- a/app/assets/stylesheets/application.sass.scss +++ b/app/assets/stylesheets/application.sass.scss @@ -6,7 +6,6 @@ $govuk-assets-path: ""; @import "components/all"; @import "accessible-autocomplete/dist/accessible-autocomplete.min"; - .app-primary-navigation { background-color: govuk-colour("light-grey"); } @@ -74,4 +73,4 @@ $govuk-assets-path: ""; color: $govuk-focus-text-colour; } } -} \ No newline at end of file +} diff --git a/app/components/navigation_bar.html.erb b/app/components/navigation_bar.html.erb index 71cc52adee..e0433f8219 100644 --- a/app/components/navigation_bar.html.erb +++ b/app/components/navigation_bar.html.erb @@ -9,9 +9,9 @@ <% items.each do |item| %>
  • <% if item[:active] %> - <%= govuk_link_to item[:name], item[:href], class:"app-primary-navigation__link", aria: { current: "page" } %> + <%= govuk_link_to item[:name], item[:href], class: "app-primary-navigation__link", aria: { current: "page" } %> <% else %> - <%= govuk_link_to item[:name], item[:href], class:"app-primary-navigation__link" %> + <%= govuk_link_to item[:name], item[:href], class: "app-primary-navigation__link" %> <% end %>
  • <% end %> diff --git a/app/controllers/claims/pages_controller.rb b/app/controllers/claims/pages_controller.rb index ce1d48e44d..9534305a24 100644 --- a/app/controllers/claims/pages_controller.rb +++ b/app/controllers/claims/pages_controller.rb @@ -1,5 +1,5 @@ class Claims::PagesController < ApplicationController def index - @school = GiasSchool.first + @school = User.first&.schools&.first&.gias_school end end diff --git a/app/helpers/navigation_bar_helper.rb b/app/helpers/navigation_bar_helper.rb index a1b2d4b1a7..4f1b967553 100644 --- a/app/helpers/navigation_bar_helper.rb +++ b/app/helpers/navigation_bar_helper.rb @@ -7,11 +7,11 @@ def navigation_items(_provider) name: t("navigation_bar.users"), url: "#", additional_url: - "request_access_publish_provider_path(provider.provider_code)" + "request_access_publish_provider_path(provider.provider_code)", }, name: t("navigation_bar.organisation_details"), url: root_path, - active: request.path == root_path + active: request.path == root_path, ] end end diff --git a/app/views/claims/pages/index.html.erb b/app/views/claims/pages/index.html.erb index d41c1a01ef..9d3a8083bf 100644 --- a/app/views/claims/pages/index.html.erb +++ b/app/views/claims/pages/index.html.erb @@ -1,23 +1,24 @@ <%= render(NavigationBar.new( items: navigation_items(@provider), current_path: request.path, - current_user: User.first + current_user: User.first, )) %> +<% if @school %>


    <%= t("organisation_details") %>

    <%= govuk_summary_list do |summary_list| summary_list.with_row do |row| - row.with_key(text: t("organisation_name")) - row.with_value(text: @school.name) - end;summary_list.with_row do |row| + row.with_key(text: t("organisation_name")) + row.with_value(text: @school.name) + end; summary_list.with_row do |row| row.with_key(text: t("uk_provider_reference_number")) row.with_value(text: @school.ukprn) - end;summary_list.with_row do |row| - row.with_key(text: t("unique_reference_number")) - row.with_value(text: @school.urn) - end;end %> + end; summary_list.with_row do |row| + row.with_key(text: t("unique_reference_number")) + row.with_value(text: @school.urn) + end; end %>

    Contact details

    <%= govuk_summary_list do |summary_list| @@ -47,3 +48,4 @@ end;end %>
    +<% end %> diff --git a/spec/factories/gias_schools.rb b/spec/factories/gias_schools.rb index f887833f46..f9d2906e15 100644 --- a/spec/factories/gias_schools.rb +++ b/spec/factories/gias_schools.rb @@ -24,7 +24,7 @@ factory :gias_school do sequence(:urn) { _1 } name { "Hogwarts" } - sequence(:ukprn) {|n| "fake_uprn_#{n}" } + sequence(:ukprn) { |n| "fake_uprn_#{n}" } telephone { "0123456789" } website { "www.hogwarts.com" } address1 { "Hogwarts Castle" } diff --git a/spec/features/personas/sign_in_as_a_claims_user_persona_spec.rb b/spec/features/personas/sign_in_as_a_claims_user_persona_spec.rb index aa6ddc93be..7cab5ecbf0 100644 --- a/spec/features/personas/sign_in_as_a_claims_user_persona_spec.rb +++ b/spec/features/personas/sign_in_as_a_claims_user_persona_spec.rb @@ -8,8 +8,7 @@ end scenario "I sign in as persona Anne" do - given_there_is_an_existing_claims_persona_for("Anne") - and_given_i_have_a_school + given_there_is_an_existing_claims_persona_for_with_a_school("Anne") when_i_visit_the_claims_personas_page then_i_see_the_claims_persona_for("Anne") when_i_click_sign_in_as("Anne") @@ -18,8 +17,7 @@ end scenario "I sign in as persona Patricia" do - given_there_is_an_existing_claims_persona_for("Patricia") - and_given_i_have_a_school + given_there_is_an_existing_claims_persona_for_with_a_school("Patricia") when_i_visit_the_claims_personas_page then_i_see_the_claims_persona_for("Patricia") when_i_click_sign_in_as("Patricia") @@ -28,8 +26,7 @@ end scenario "I sign in as persona Mary" do - given_there_is_an_existing_claims_persona_for("Mary") - and_given_i_have_a_school + given_there_is_an_existing_claims_persona_for_with_a_school("Mary") when_i_visit_the_claims_personas_page then_i_see_the_claims_persona_for("Mary") when_i_click_sign_in_as("Mary") @@ -38,8 +35,7 @@ end scenario "I sign in as persona colin" do - given_there_is_an_existing_claims_persona_for("Colin") - and_given_i_have_a_school + given_there_is_an_existing_claims_persona_for_with_a_school("Colin") when_i_visit_the_claims_personas_page then_i_see_the_claims_persona_for("Colin") when_i_click_sign_in_as("Colin") @@ -50,12 +46,8 @@ private -def given_there_is_an_existing_claims_persona_for(persona_name) - create(:persona, persona_name.downcase.to_sym, service: "claims") -end - -def and_given_i_have_a_school - create(:gias_school) +def given_there_is_an_existing_claims_persona_for_with_a_school(persona_name) + create(:membership, user: create(:persona, persona_name.downcase.to_sym, service: "claims"), organisation: create(:school)) end def when_i_visit_the_claims_personas_page diff --git a/spec/system/claims/pages/home_spec.rb b/spec/system/claims/pages/home_spec.rb index b95f43623d..1adff79954 100644 --- a/spec/system/claims/pages/home_spec.rb +++ b/spec/system/claims/pages/home_spec.rb @@ -10,7 +10,6 @@ when_i_visit_home_page i_can_see_organisation_details i_can_see_contact_details - end private @@ -24,9 +23,9 @@ def when_i_visit_home_page end def given_there_is_an_existing_persona_for(persona_name) - user = create(:persona, persona_name.downcase.to_sym,service:"claims") - create(:gias_school) - DfESignInUser.load_from_session({"dfe_sign_in_user"=>{"email"=>user.email},"service" =>:claims}) + user = create(:persona, persona_name.downcase.to_sym, service: "claims") + create(:membership, user:, organisation: create(:school)) + DfESignInUser.load_from_session({ "dfe_sign_in_user" => { "email" => user.email }, "service" => :claims }) end def i_can_see_organisation_details diff --git a/spec/system/claims/view_organisations_spec.rb b/spec/system/claims/view_organisations_spec.rb index b7a9d8c296..3c08d7b055 100644 --- a/spec/system/claims/view_organisations_spec.rb +++ b/spec/system/claims/view_organisations_spec.rb @@ -22,14 +22,14 @@ when_i_click_sign_in(persona) i_am_redirected_to_the_root_path end -end -private + private -def given_the_claims_persona(persona_name) - create(:persona, persona_name.downcase.to_sym, service: "claims") -end + def given_the_claims_persona(persona_name) + create(:persona, persona_name.downcase.to_sym, service: "claims") + end +<<<<<<< HEAD def and_persona_has_multiple_schools(persona) school1 = create(:school) school2 = create(:school) @@ -40,21 +40,42 @@ def and_persona_has_multiple_schools(persona) def and_persona_has_one_school(persona) create(:membership, user: persona, organisation: create(:school)) end +======= + def and_persona_has_multiple_organisations(persona) + school1 = create(:school) + school2 = create(:school) + create(:membership, user: persona, organisation: school1) + create(:membership, user: persona, organisation: school2) + end -def when_i_visit_claims_personas - visit personas_path -end + def and_persona_has_one_organisation(persona) + create(:membership, user: persona, organisation: create(:school)) + end +>>>>>>> fix request changes -def when_i_click_sign_in(persona) - click_on "Sign In as #{persona.first_name}" -end + def when_i_visit_claims_personas + visit personas_path + end + + def when_i_click_sign_in(persona) + click_on "Sign In as #{persona.first_name}" + end +<<<<<<< HEAD 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) end +======= + def i_can_see_a_list_marys_claims_organisations(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) + end +>>>>>>> fix request changes -def i_am_redirected_to_the_root_path - expect(page).to have_content("It works!") + def i_am_redirected_to_the_root_path + expect(page).to have_content("Claim Funding for General Mentors") + end end diff --git a/spec/system/home_page_spec.rb b/spec/system/home_page_spec.rb index f3ced58cfa..7cbf86a763 100644 --- a/spec/system/home_page_spec.rb +++ b/spec/system/home_page_spec.rb @@ -5,7 +5,6 @@ scenario "User visits the claims homepage" do given_i_am_on_the_claims_site - and_given_i_have_a_school and_i_am_on_the_start_page i_can_see_the_claims_service_name_in_the_header and_i_can_see_the_claims_service_value_in_the_page @@ -28,10 +27,6 @@ def given_i_am_on_the_placements_site Capybara.app_host = "http://#{ENV["PLACEMENTS_HOST"]}" end - def and_given_i_have_a_school - create(:gias_school) - end - def and_i_am_on_the_start_page visit "/" end diff --git a/spec/system/placements/view_organisations_spec.rb b/spec/system/placements/view_organisations_spec.rb index f4b70e59d9..54f43e1a5a 100644 --- a/spec/system/placements/view_organisations_spec.rb +++ b/spec/system/placements/view_organisations_spec.rb @@ -22,41 +22,41 @@ when_i_click_sign_in(persona) i_am_redirected_to_the_root_path end -end -private + private -def given_the_placements_persona(persona_name) - create(:persona, persona_name.downcase.to_sym, service: "placements") -end + def given_the_placements_persona(persona_name) + create(:persona, persona_name.downcase.to_sym, service: "placements") + end -def and_persona_has_multiple_organisations(persona) - school1 = create(:school) - provider = create(:provider) - create(:membership, user: persona, organisation: school1) - create(:membership, user: persona, organisation: provider) -end + def and_persona_has_multiple_organisations(persona) + school1 = create(:school) + provider = create(:provider) + create(:membership, user: persona, organisation: school1) + create(:membership, user: persona, organisation: provider) + end -def and_persona_has_one_organisation(persona) - create(:membership, user: persona, organisation: create(:school)) -end + def and_persona_has_one_organisation(persona) + create(:membership, user: persona, organisation: create(:school)) + end -def when_i_visit_placements_personas - visit personas_path -end + def when_i_visit_placements_personas + visit personas_path + end -def when_i_click_sign_in(persona) - click_on "Sign In as #{persona.first_name}" -end + def when_i_click_sign_in(persona) + click_on "Sign In as #{persona.first_name}" + end -def i_can_see_a_list_marys_placements_organisations(persona) - expect(page).to have_content("Organisations") - expect(page).to have_content("Schools") - expect(page).to have_content("Providers") - expect(page).to have_content(persona.schools.first.name) - expect(page).to have_content(persona.providers.first.provider_code) -end + def i_can_see_a_list_marys_placements_organisations(persona) + expect(page).to have_content("Organisations") + expect(page).to have_content("Schools") + expect(page).to have_content("Providers") + expect(page).to have_content(persona.schools.first.name) + expect(page).to have_content(persona.providers.first.provider_code) + end -def i_am_redirected_to_the_root_path - expect(page).to have_content("It works!") + def i_am_redirected_to_the_root_path + expect(page).to have_content("It works!") + end end