returns empty 404 instead of raising exception
for the catch-all route
This commit is contained in:
committed by
Juanjo Bazán
parent
a31a71a45f
commit
2d4d057b48
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user