From e74930cf92fca9662c9026473d6c5726939f9c72 Mon Sep 17 00:00:00 2001 From: Arthur Campbell Date: Fri, 17 Mar 2023 09:28:53 +0000 Subject: [PATCH] utilise rails url helpers --- app/views/form/check_answers.html.erb | 5 ++--- app/views/form/review.html.erb | 10 +++++----- spec/features/sales_log_spec.rb | 2 -- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/views/form/check_answers.html.erb b/app/views/form/check_answers.html.erb index 774081a4d..3da071be5 100644 --- a/app/views/form/check_answers.html.erb +++ b/app/views/form/check_answers.html.erb @@ -1,8 +1,7 @@ <% content_for :title, "#{subsection.id.humanize} - Check your answers" %> -<% class_name = @log.class.name.underscore %> <% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: { - "Logs" => send("#{class_name.pluralize}_path"), - "Log #{@log.id}" => send("#{class_name}_path", @log), + "Logs" => url_for(@log.class), + "Log #{@log.id}" => url_for(@log), subsection.label => "", }) %> diff --git a/app/views/form/review.html.erb b/app/views/form/review.html.erb index 8c626beec..3268df478 100644 --- a/app/views/form/review.html.erb +++ b/app/views/form/review.html.erb @@ -1,9 +1,9 @@ -<% class_name = @log.class.name.underscore %> -<% content_for :title, "Review #{class_name.humanize(capitalize: false)}" %> +<% class_name = @log.class.name.underscore.humanize(capitalize: false) %> +<% content_for :title, "Review #{class_name}" %> <% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: { - "Logs" => send("#{class_name.pluralize}_path"), - "Log #{@log.id}" => send("#{class_name}_path", @log.id), - "Review #{class_name.humanize(capitalize: false)}" => "", + "Logs" => url_for(@log.class), + "Log #{@log.id}" => url_for(@log), + "Review #{class_name}" => "", }) %>
diff --git a/spec/features/sales_log_spec.rb b/spec/features/sales_log_spec.rb index 332605bd7..759b298f3 100644 --- a/spec/features/sales_log_spec.rb +++ b/spec/features/sales_log_spec.rb @@ -88,7 +88,6 @@ RSpec.describe "Sales Log Features" do end context "when visiting a subsection check answers page as a support user" do - it "has the correct breadcrumbs with the correct links" do visit sales_log_setup_check_answers_path(sales_log.id) breadcrumbs = page.find_all(".govuk-breadcrumbs__link") @@ -100,7 +99,6 @@ RSpec.describe "Sales Log Features" do end context "when reviewing a complete log" do - it "has the correct breadcrumbs with the correct links" do visit review_sales_log_path(sales_log.id, sales_log: true) breadcrumbs = page.find_all(".govuk-breadcrumbs__link")