Merge pull request #747 from metamaps/fix/unauth-error

redirect to root_path if you get a 403
This commit is contained in:
Devin Howard 2016-10-08 14:16:13 +08:00 committed by GitHub
commit 9d85dab975
2 changed files with 3 additions and 3 deletions

View file

@ -35,7 +35,7 @@ class ApplicationController < ActionController::Base
def handle_unauthorized def handle_unauthorized
if authenticated? if authenticated?
head :forbidden # TODO: make this better redirect_to root_path, notice: "You don't have permission to see that page."
else else
redirect_to new_user_session_path, notice: 'Try signing in to do that.' redirect_to new_user_session_path, notice: 'Try signing in to do that.'
end end

View file

@ -79,8 +79,8 @@ RSpec.describe MapsController, type: :controller do
id: unowned_map.to_param id: unowned_map.to_param
} }
end.to change(Map, :count).by(0) end.to change(Map, :count).by(0)
expect(response.body).to eq '' expect(response.headers['Location']).to eq(request.base_url + root_path)
expect(response.status).to eq 403 expect(response.status).to eq 302
end end
it 'deletes owned map' do it 'deletes owned map' do