returns 404 for not found pages

(instead of 500 by MissingTemplate)

Fixes #792
This commit is contained in:
Juanjo Bazán
2015-12-30 14:27:16 +01:00
parent f7f32747f0
commit bbc0f07b74
2 changed files with 8 additions and 0 deletions

View File

@@ -3,5 +3,7 @@ class PagesController < ApplicationController
def show
render action: params[:id]
rescue ActionView::MissingTemplate
raise ActionController::RoutingError.new('Not Found')
end
end

View File

@@ -58,4 +58,10 @@ describe PagesController do
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