diff --git a/app/controllers/cabpools_controller.rb b/app/controllers/cabpools_controller.rb index 138e1d6..25f6d37 100644 --- a/app/controllers/cabpools_controller.rb +++ b/app/controllers/cabpools_controller.rb @@ -3,7 +3,6 @@ class CabpoolsController < ApplicationController before_action :registered? , except: [:show, :approve_reject_handler] before_action :has_cabpool, only: [:leave] before_action :has_cabpool_or_request, only: [:your_cabpools] - before_action :has_cabpool_or_request, only: [:your_cabpools] before_action :user_should_not_have_cabpool, only: :new def user_should_not_have_cabpool @@ -11,7 +10,7 @@ def user_should_not_have_cabpool if !user.nil? if user.cabpool flash[:danger] = "You are already part of a Cab pool. Please leave the cabpool to create a new cab pool." - redirect_to(root_path) + redirect_to your_cabpools_path end end end diff --git a/spec/controllers/cabpools_controller_spec.rb b/spec/controllers/cabpools_controller_spec.rb index 5af6113..6aaac09 100644 --- a/spec/controllers/cabpools_controller_spec.rb +++ b/spec/controllers/cabpools_controller_spec.rb @@ -434,6 +434,6 @@ get :new expect(flash[:danger]).to eq "You are already part of a Cab pool. Please leave the cabpool to create a new cab pool." - expect(response).to redirect_to root_path + expect(response).to redirect_to your_cabpools_path end end