diff --git a/app/views/check_records/search/show.html.erb b/app/views/check_records/search/show.html.erb index 31977338..3f93871f 100644 --- a/app/views/check_records/search/show.html.erb +++ b/app/views/check_records/search/show.html.erb @@ -20,19 +20,32 @@ <%= teacher.sanctions.any? ? "Restrictions" : "No restrictions" %> - <% - rows = [ - { - key: { text: "TRN" }, - value: { text: teacher.trn } - }, - { - key: { text: "Date of birth" }, - value: { text: Date.parse(teacher.date_of_birth).to_fs(:long_uk) } - } - ] + <%= govuk_summary_list borders: false, classes: ['app-summary-list--compact'] do |summary_list| + summary_list.with_row do |row| + row.with_key { "TRN" } + row.with_value { teacher.trn } + end + + summary_list.with_row do |row| + row.with_key { "Date of birth" } + row.with_value { Date.parse(teacher.date_of_birth).to_fs(:long_uk) } + end + + if teacher.sanctions.any? + summary_list.with_row do |row| + row.with_key { "Restrictions" } + row.with_value do + %> + + <% end + end + end + end %> - <%= render GovukComponent::SummaryListComponent.new(rows:, borders: false, classes: ['app-summary-list--compact']) %> <% end %> diff --git a/spec/support/fake_qualifications_api.rb b/spec/support/fake_qualifications_api.rb index 7f66f60a..f3de5bab 100644 --- a/spec/support/fake_qualifications_api.rb +++ b/spec/support/fake_qualifications_api.rb @@ -101,6 +101,10 @@ def sanctions_data { code: "C2", startDate: "2019-10-25" + }, + { + code: "A1A", + startDate: "2018-9-20" } ], trn: "987654321" diff --git a/spec/system/check_records/user_searches_for_teacher_with_restrictions_spec.rb b/spec/system/check_records/user_searches_for_teacher_with_restrictions_spec.rb index de5d8afe..52b7f730 100644 --- a/spec/system/check_records/user_searches_for_teacher_with_restrictions_spec.rb +++ b/spec/system/check_records/user_searches_for_teacher_with_restrictions_spec.rb @@ -30,6 +30,8 @@ def and_search_returns_a_restricted_record def then_i_see_the_restriction_on_the_result expect(page).to have_title("Search results (1) - Check a teacher’s record") expect(page).to have_content("RESTRICTIONS") + expect(page).to have_content("Failed induction") + expect(page).to have_content("Prohibition by the General Teaching Council England (GTCE)") end def when_i_click_on_the_result