Browse Source

adding scheme_edit_name route

pull/717/head
JG 3 years ago
parent
commit
d457f22f79
  1. 2
      app/views/schemes/show.html.erb
  2. 1
      config/routes.rb
  3. 6
      spec/features/schemes_spec.rb

2
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 %>

1
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

6
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

Loading…
Cancel
Save