Browse Source

flashing test

pull/671/head
JG 3 years ago
parent
commit
896c31bad8
  1. 1
      app/controllers/schemes_controller.rb
  2. 2
      app/views/schemes/check_answers.html.erb
  3. 8
      spec/requests/schemes_controller_spec.rb

1
app/controllers/schemes_controller.rb

@ -7,6 +7,7 @@ class SchemesController < ApplicationController
before_action :authenticate_scope!
def index
flash[:notice] = ("#{Scheme.find(params[:scheme_id].to_i).service_name} has been created.") if params[:scheme_id]
redirect_to schemes_organisation_path(current_user.organisation) unless current_user.support?
all_schemes = Scheme.all

2
app/views/schemes/check_answers.html.erb

@ -62,4 +62,4 @@
<% end %>
<% end %>
<%= govuk_button_link_to "Create scheme", schemes_path, html: { method: :get } %>
<%= govuk_button_link_to "Create scheme", schemes_path(scheme_id: @scheme.id), html: { method: :get } %>

8
spec/requests/schemes_controller_spec.rb

@ -37,6 +37,14 @@ RSpec.describe SchemesController, type: :request do
get "/schemes"
end
context "params scheme_id is present" do
it "shows a success banner" do
get "/schemes", params: { scheme_id: schemes.first.id }
follow_redirect!
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
end
end
it "redirects to the organisation schemes path" do
follow_redirect!
expect(path).to match("/organisations/#{user.organisation.id}/schemes")

Loading…
Cancel
Save