From d457f22f79b17b5d408dfa76fb0e807c5cbaf480 Mon Sep 17 00:00:00 2001 From: JG Date: Thu, 7 Jul 2022 13:18:19 +0100 Subject: [PATCH] adding scheme_edit_name route --- app/views/schemes/show.html.erb | 2 +- config/routes.rb | 1 + spec/features/schemes_spec.rb | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/schemes/show.html.erb b/app/views/schemes/show.html.erb index a7f6734b8..ecc0dd27c 100644 --- a/app/views/schemes/show.html.erb +++ b/app/views/schemes/show.html.erb @@ -19,7 +19,7 @@ <%= summary_list.row do |row| %> <% row.key { attr[:name].eql?("Registered under Care Standards Act 2000") ? "Registered under Care Standards Act 2000" : attr[:name].to_s.humanize } %> <% row.value { details_html(attr) } %> - <% row.action(text: "Change", href: scheme_primary_client_group_path(scheme_id: @scheme.id, check_answers: true)) if attr[:edit] %> + <% row.action(text: "Change", href: scheme_edit_name_path(scheme_id: @scheme.id)) if attr[:edit] %> <% end %> <% end %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index a643f2ab4..1d27b0e41 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -42,6 +42,7 @@ Rails.application.routes.draw do get "support", to: "schemes#support" get "details", to: "schemes#details" get "check-answers", to: "schemes#check_answers" + get "edit-name", to: "schemes#edit-name" member do resources :locations diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 6f4b470f1..9e11edcd6 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -700,10 +700,12 @@ RSpec.describe "Schemes scheme Features" do context "when I click to change scheme name" do before do - click_link("Change") + click_link("Change", href: "/schemes/#{scheme.id}/edit-name", match: :first) end - it "shows list of links to schemes" do + it "shows available fields to edit" do + expect(page).to have_current_path("/schemes/#{scheme.id}/edit-name") + expect(page).to have_content "Scheme details" end end end