Skip to content

Commit

Permalink
fix request changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SocFoot committed Jan 2, 2024
1 parent 6bb7df2 commit f9a87ee
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 81 deletions.
3 changes: 1 addition & 2 deletions app/assets/stylesheets/application.sass.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -74,4 +73,4 @@ $govuk-assets-path: "";
color: $govuk-focus-text-colour;
}
}
}
}
4 changes: 2 additions & 2 deletions app/components/navigation_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<% items.each do |item| %>
<li class="app-primary-navigation__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 %>
</li>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/claims/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Claims::PagesController < ApplicationController
def index
@school = GiasSchool.first
@school = User.first&.schools&.first&.gias_school
end
end
4 changes: 2 additions & 2 deletions app/helpers/navigation_bar_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 10 additions & 8 deletions app/views/claims/pages/index.html.erb
Original file line number Diff line number Diff line change
@@ -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 %>
<div class="govuk-grid-row">
<br><br>
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l"><%= t("organisation_details") %></h1>
<%= 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 %>

<h2 class="govuk-heading-m govuk-!-margin-top-9">Contact details</h2>
<%= govuk_summary_list do |summary_list|
Expand Down Expand Up @@ -47,3 +48,4 @@
end;end %>
</div>
</div>
<% end %>
2 changes: 1 addition & 1 deletion spec/factories/gias_schools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
20 changes: 6 additions & 14 deletions spec/features/personas/sign_in_as_a_claims_user_persona_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions spec/system/claims/pages/home_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
when_i_visit_home_page
i_can_see_organisation_details
i_can_see_contact_details

end

private
Expand All @@ -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
Expand Down
47 changes: 34 additions & 13 deletions spec/system/claims/view_organisations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
5 changes: 0 additions & 5 deletions spec/system/home_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
58 changes: 29 additions & 29 deletions spec/system/placements/view_organisations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f9a87ee

Please sign in to comment.