Skip to content

Commit

Permalink
Replace content on school placements page
Browse files Browse the repository at this point in the history
We will only show this page when provider chooses the school placements
to be selectable.
  • Loading branch information
tomas-stefano committed Oct 18, 2024
1 parent 084aa2c commit 480b96d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/controllers/find/placements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Find
class PlacementsController < ApplicationController
before_action -> { render_not_found if provider.nil? }
before_action -> { render_not_found if provider.nil? || provider.selectable_school.blank? }

def index
@course = provider.courses.includes(
Expand Down
7 changes: 1 addition & 6 deletions app/views/shared/courses/_placements.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
<%= t(".heading", provider_name: course.provider_name) %>
</h1>

<%= govuk_warning_text(text: t(".warning")) %>

<p class="govuk-body">
<%= t(".will_place_you", provider_name: course.provider_name) %>
</p>

<p class="govuk-body"><%= t(".schools_to_be_placed") %></p>
<p class="govuk-body"><%= t(".schools_you_can_choose") %></p>

<ul class="govuk-list govuk-list--spaced" id="course_school_placements">
<% course.preview_site_statuses.each do |site_status| %>
Expand Down
5 changes: 2 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ en:
heading: Contact %{provider_name}
placements:
heading: School placements at %{provider_name}
warning: You can’t pick which schools you will be in.
will_place_you: '%{provider_name} will place you in different schools you can travel to during your training.'
schools_to_be_placed: 'The schools you could be placed in are:'
schools_to_be_placed: You will be able to select a preferred placement location, but there is no guarantee you will be placed in the school you have chosen. The training provider will contact you to discuss your choice to help them select a location that suits you.
schools_you_can_choose: 'The schools you can choose from are:'
school_placements_advice:
view:
heading: How school placements work
Expand Down
28 changes: 28 additions & 0 deletions spec/controllers/find/placements_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ module Find
end
end

context 'when provider sets school_placement as not selectable' do
it 'renders the not found page' do
provider = create(:provider, selectable_school: false)
course = create(:course, :published, provider:)

get :index, params: {
provider_code: provider.provider_code,
course_code: course.course_code
}

expect(response).to render_template('errors/not_found')
end
end

context 'when course is not published' do
it 'renders the not found page' do
provider = create(:provider)
Expand All @@ -33,6 +47,20 @@ module Find
expect(response).to render_template('errors/not_found')
end
end

context 'when course is published and school placement is selectable' do
it 'respond successfully' do
provider = create(:provider, selectable_school: true)
course = create(:course, :published, provider:)

get :index, params: {
provider_code: provider.provider_code,
course_code: course.course_code
}

expect(response).to have_http_status(:success)
end
end
end
end
end
3 changes: 3 additions & 0 deletions spec/features/find/search/viewing_a_course_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ def when_i_click(button)
alias_method :and_i_click, :when_i_click

def then_i_should_be_on_the_school_placements_page
expect(page).to have_content(
'You will be able to select a preferred placement location, but there is no guarantee you will be placed in the school you have chosen. The training provider will contact you to discuss your choice to help them select a location that suits you.'
)
@course.site_statuses.new_or_running.map(&:site).uniq.each do |site|
expect(find_course_show_page).to have_content(smart_quotes(site.decorate.full_address))
end
Expand Down

0 comments on commit 480b96d

Please sign in to comment.