returns 404 for not found pages
(instead of 500 by MissingTemplate) Fixes #792
This commit is contained in:
@@ -3,5 +3,7 @@ class PagesController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
render action: params[:id]
|
render action: params[:id]
|
||||||
|
rescue ActionView::MissingTemplate
|
||||||
|
raise ActionController::RoutingError.new('Not Found')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -58,4 +58,10 @@ describe PagesController do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'Not found pages' do
|
||||||
|
it 'should return a 404 message' do
|
||||||
|
expect { get :show, id: "nonExistentPage" }.to raise_error(ActionController::RoutingError)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user