returns empty 404 instead of raising exception

for the catch-all route
This commit is contained in:
Juanjo Bazán
2016-01-20 16:16:13 +01:00
committed by Juanjo Bazán
parent a31a71a45f
commit 2d4d057b48
2 changed files with 3 additions and 2 deletions

View File

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

View File

@@ -60,7 +60,8 @@ describe PagesController do
describe 'Not found pages' do describe 'Not found pages' do
it 'should return a 404 message' do it 'should return a 404 message' do
expect { get :show, id: "nonExistentPage" }.to raise_error(ActionController::RoutingError) get :show, id: "nonExistentPage"
expect(response).to be_missing
end end
end end