diff --git a/app/views/schemes/show.html.erb b/app/views/schemes/show.html.erb index ce5a35f70..ad2e858b2 100644 --- a/app/views/schemes/show.html.erb +++ b/app/views/schemes/show.html.erb @@ -22,8 +22,8 @@ <% row.key { attr[:name] } %> <% row.value do %> <%= details_html(attr) %> - <% if attr[:name] == "Status" && @scheme.confirmed? && @scheme.locations.confirmed.none? %> - Add a location to complete this scheme + <% if attr[:name] == "Status" && @scheme.confirmed? && @scheme.locations.confirmed.none? && LocationPolicy.new(current_user, @scheme.locations.new).create? %> + Complete this scheme by adding a location using the <%= govuk_link_to("‘locations’ tab", scheme_locations_path(@scheme)) %>. <% end %> <% end %> <% if SchemePolicy.new(current_user, @scheme).update? %> diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index 9d322ec87..9579fb2a4 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -603,7 +603,8 @@ RSpec.describe SchemesController, type: :request do it "shows the scheme as incomplete with text to explain" do get scheme_path(specific_scheme) expect(page).to have_content "Incomplete" - expect(page).to have_content "Add a location to complete this scheme" + expect(page).to have_content "Complete this scheme by adding a location using the" + expect(page).to have_link "‘locations’ tab" end end @@ -612,7 +613,8 @@ RSpec.describe SchemesController, type: :request do create(:location, scheme: specific_scheme) get scheme_path(specific_scheme) expect(page).to have_content "Active" - expect(page).not_to have_content "Add a location to complete this scheme" + expect(page).not_to have_content "Complete this scheme by adding a location using the" + expect(page).not_to have_link "‘locations’ tab" end end end