diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c35bc5b22..72f41abb9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -108,7 +108,7 @@ class ApplicationController < ActionController::Base def set_return_url if !devise_controller? && controller_name != "welcome" && is_navigational_format? - store_location_for(:user, request.path) + store_location_for(:user, request.fullpath) end end diff --git a/spec/system/sessions_spec.rb b/spec/system/sessions_spec.rb index 74c1781d5..470fe358b 100644 --- a/spec/system/sessions_spec.rb +++ b/spec/system/sessions_spec.rb @@ -17,4 +17,17 @@ describe "Sessions" do expect(page).to have_content("You have been signed out successfully") expect(page).to have_current_path(debate_path(debate)) end + + scenario "Sign in redirects keeping GET parameters" do + create(:user, :level_two, email: "dev@consul.dev", password: "consuldev") + heading = create(:budget_heading, name: "outskirts") + + visit budget_investments_path(heading.budget, heading_id: "outskirts") + click_link "Sign in" + fill_in "user_login", with: "dev@consul.dev" + fill_in "user_password", with: "consuldev" + click_button "Enter" + + expect(page).to have_current_path budget_investments_path(heading.budget, heading_id: "outskirts") + end end