-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented custom dynamic error pages. Fixes #221.
- Loading branch information
1 parent
1898e24
commit d1cec7e
Showing
12 changed files
with
91 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class ErrorsController < ApplicationController | ||
def not_found | ||
render(status: 404) | ||
end | ||
|
||
def internal_server_error | ||
render(status: 500) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.panel.panel-danger | ||
.panel-heading | ||
%h1 | ||
%span.glyphicon.glyphicon-warning-sign | ||
<strong>500</strong> Internal Server Error! | ||
.panel-body | ||
%p This is a bug, please report it to your administrator! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.panel.panel-danger | ||
.panel-heading | ||
%h1 | ||
%span.glyphicon.glyphicon-warning-sign | ||
<strong>404</strong> Page Not Found! | ||
.panel-body | ||
%p The page you are looking for does not exist. | ||
%p If you think this is a bug please report it to your administrator! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'rails_helper' | ||
|
||
describe ErrorsController do | ||
describe 'GET #not_found' do | ||
it 'returns http not_foudn' do | ||
get :not_found | ||
|
||
expect(response).to have_http_status(:not_found) | ||
end | ||
end | ||
|
||
describe 'GET #internal_server_error' do | ||
it 'returns http internal_server_error' do | ||
get :internal_server_error | ||
|
||
expect(response).to have_http_status(:internal_server_error) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'rails_helper' | ||
|
||
feature 'User accesses invalid page' do | ||
# Make it like we're accessing in production | ||
around :each do |example| | ||
Rails.application.config.consider_all_requests_local = false | ||
Rails.application.config.action_dispatch.show_exceptions = true | ||
example.run | ||
Rails.application.config.consider_all_requests_local = true | ||
Rails.application.config.action_dispatch.show_exceptions = false | ||
end | ||
|
||
scenario 'authenticated user' do | ||
visit team_path(-1) | ||
|
||
expect(page).to have_content '404' | ||
end | ||
|
||
scenario 'unauthenticated user' do | ||
visit team_path(-1) | ||
|
||
expect(page).to have_content '404' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'rails_helper' | ||
|
||
describe 'errors/internal_server_error.html.haml' do | ||
it 'renders' do | ||
render | ||
|
||
expect(rendered).to include('500') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'rails_helper' | ||
|
||
describe 'errors/not_found.html.haml' do | ||
it 'renders' do | ||
render | ||
|
||
expect(rendered).to include('404') | ||
end | ||
end |