Skip to content

Commit

Permalink
Exceptions app should refer to app/views/#{config.view_path}
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki24 committed Sep 5, 2014
1 parent c18ef37 commit a33220b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rambulance/exceptions_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ def exception
end

def error_path(status_in_words = status_in_words())
"#{Rambulance.view_path}/#{status_in_words}"
"#{controller_path}/#{status_in_words}"
end

def layout_name
Rambulance.layout_name
end

def controller_path
Rambulance.view_path
end
end
end
2 changes: 2 additions & 0 deletions spec/fake_app/lib/exceptions_app.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class ExceptionsApp < Rambulance::ExceptionsApp
def not_found; end

def internal_server_error
render inline: <<-BODY
<html>
Expand Down
8 changes: 8 additions & 0 deletions spec/requests/error_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
context "With a custom exception app", if: ENV["CUSTOM_EXCEPTIONS_APP"] do
it_behaves_like "an action that renders 500 page if the template is missing"

scenario 'Not found due to ActinoController::RoutingError' do
visit '/doesnt_exist'

page.status_code.should == 404
page.body.should have_content "Error page"
page.body.should have_content "Page not found."
end

scenario 'Internal server error due to RuntimeError' do
visit '/users/1'

Expand Down

0 comments on commit a33220b

Please sign in to comment.