diff --git a/app/views/logs/delete_duplicates.html.erb b/app/views/logs/delete_duplicates.html.erb index 18b3d56e4..4acfc2314 100644 --- a/app/views/logs/delete_duplicates.html.erb +++ b/app/views/logs/delete_duplicates.html.erb @@ -1,6 +1,6 @@ <% content_for :before_content do %> <% content_for :title, "Are you sure you want to delete #{@duplicate_logs.count == 1 ? 'this duplicate log' : 'these duplicate logs'}?" %> - <%= govuk_back_link href: @log.lettings? ? lettings_log_duplicate_logs_path(@log) : sales_log_duplicate_logs_path(@log) %> + <%= govuk_back_link href: @log.lettings? ? lettings_log_duplicate_logs_path(@original_log, original_log_id: @original_log.id) : sales_log_duplicate_logs_path(@original_log, original_log_id: @original_log.id) %> <% end %>
@@ -32,7 +32,7 @@ params: { ids: @duplicate_logs.map(&:id), original_log_id: @original_log.id, remaining_log_id: @log.id } %> <%= govuk_button_link_to( "Cancel", - send("#{@log.class.name.underscore}_duplicate_logs_path", @log), + send("#{@log.class.name.underscore}_duplicate_logs_path", @original_log, original_log_id: @original_log.id), secondary: true, ) %>
diff --git a/spec/requests/duplicate_logs_controller_spec.rb b/spec/requests/duplicate_logs_controller_spec.rb index fa989e836..9df134e76 100644 --- a/spec/requests/duplicate_logs_controller_spec.rb +++ b/spec/requests/duplicate_logs_controller_spec.rb @@ -192,8 +192,8 @@ RSpec.describe DuplicateLogsController, type: :request do expect(page).to have_button(text: "Delete this log") expect(page).to have_link(text: "Log #{duplicate_log.id}", href: sales_log_path(duplicate_log.id)) expect(page).not_to have_link(text: "Log #{id}", href: sales_log_path(id)) - expect(page).to have_link(text: "Cancel", href: sales_log_duplicate_logs_path(id)) - expect(page).to have_link(text: "Back", href: sales_log_duplicate_logs_path(id)) + expect(page).to have_link(text: "Cancel", href: sales_log_duplicate_logs_path(id, original_log_id: id)) + expect(page).to have_link(text: "Back", href: sales_log_duplicate_logs_path(id, original_log_id: id)) end end @@ -210,8 +210,8 @@ RSpec.describe DuplicateLogsController, type: :request do expect(page).to have_button(text: "Delete these logs") expect(page).to have_link(text: "Log #{duplicate_log.id}", href: sales_log_path(duplicate_log.id)) expect(page).to have_link(text: "Log #{duplicate_log_2.id}", href: sales_log_path(duplicate_log_2.id)) - expect(page).to have_link(text: "Cancel", href: sales_log_duplicate_logs_path(id)) - expect(page).to have_link(text: "Back", href: sales_log_duplicate_logs_path(id)) + expect(page).to have_link(text: "Cancel", href: sales_log_duplicate_logs_path(id, original_log_id: id)) + expect(page).to have_link(text: "Back", href: sales_log_duplicate_logs_path(id, original_log_id: id)) end end @@ -267,8 +267,8 @@ RSpec.describe DuplicateLogsController, type: :request do expect(page).to have_button(text: "Delete this log") expect(page).to have_link(text: "Log #{duplicate_log.id}", href: lettings_log_path(duplicate_log.id)) expect(page).not_to have_link(text: "Log #{id}", href: lettings_log_path(id)) - expect(page).to have_link(text: "Cancel", href: lettings_log_duplicate_logs_path(id)) - expect(page).to have_link(text: "Back", href: lettings_log_duplicate_logs_path(id)) + expect(page).to have_link(text: "Cancel", href: lettings_log_duplicate_logs_path(id, original_log_id: id)) + expect(page).to have_link(text: "Back", href: lettings_log_duplicate_logs_path(id, original_log_id: id)) end end @@ -285,8 +285,8 @@ RSpec.describe DuplicateLogsController, type: :request do expect(page).to have_button(text: "Delete these logs") expect(page).to have_link(text: "Log #{duplicate_log.id}", href: lettings_log_path(duplicate_log.id)) expect(page).to have_link(text: "Log #{duplicate_log_2.id}", href: lettings_log_path(duplicate_log_2.id)) - expect(page).to have_link(text: "Cancel", href: lettings_log_duplicate_logs_path(id)) - expect(page).to have_link(text: "Back", href: lettings_log_duplicate_logs_path(id)) + expect(page).to have_link(text: "Cancel", href: lettings_log_duplicate_logs_path(id, original_log_id: id)) + expect(page).to have_link(text: "Back", href: lettings_log_duplicate_logs_path(id, original_log_id: id)) end end