rambulance 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 371368ef15c8a2428abac262161e5d591a3b1e21
4
- data.tar.gz: a4b52cc04381d65a5b787a88241d0c8268376955
3
+ metadata.gz: 146d016881be5aa21f7d33de3bab927491c06160
4
+ data.tar.gz: d0ef5bc64965f81c3834865772875b399161a074
5
5
  SHA512:
6
- metadata.gz: 85182daad34f54b4c63ecc95984dc4b94047bb47b058dd9c596d23593ec399c60b152b242b43eeb8050af2fdfc5feecf272702abade061e2857a717b20df4bc8
7
- data.tar.gz: ec70b4eb6b526bc4e9ba6532a90f39fa9c9e67ca072ab50e358896166558c44966be276a51de1db345acd8657065e78da2ba936c154f04a75dbe4d5f846d2eec
6
+ metadata.gz: f9459c8e769ae84353aac43085acb710c64fb94f469fe28530fe0797988592ae38eff50f3512e0ad15b36c300940013e441eed8c1f000cc714a046d52a887dfa
7
+ data.tar.gz: 0761811510d0c91d4efc7c6c4446dc2bd6e71f95a2f7876d046ec034a4d4ee052148a6ae4ce13f28b688c5ce278da3c75f65a5d666acb5f17338118d90146210
@@ -3,11 +3,11 @@ require "rambulance/railtie"
3
3
 
4
4
  module Rambulance
5
5
 
6
- # List of custom pairs of cexception/corresponding http status.
6
+ # List of custom pairs of exception/corresponding http status.
7
7
  mattr_reader :rescue_responses
8
8
  @@rescue_responses = {}
9
9
 
10
- # The template name for the layout of the error pages.
10
+ # The name of the layout file for the error pages.
11
11
  mattr_accessor :layout_name
12
12
  @@layout_name = "error"
13
13
 
@@ -8,7 +8,7 @@ module Rambulance
8
8
  end.invert
9
9
 
10
10
  class ExceptionsApp < ActionController::Base
11
- layout Rambulance.layout_name
11
+ layout :layout_name
12
12
 
13
13
  def self.call(env)
14
14
  exception = env["action_dispatch.exception"]
@@ -50,7 +50,15 @@ module Rambulance
50
50
  end
51
51
 
52
52
  def error_path(status_in_words = status_in_words())
53
- "#{Rambulance.view_path}/#{status_in_words}"
53
+ "#{controller_path}/#{status_in_words}"
54
+ end
55
+
56
+ def layout_name
57
+ Rambulance.layout_name
58
+ end
59
+
60
+ def controller_path
61
+ Rambulance.view_path
54
62
  end
55
63
  end
56
64
  end
@@ -1,3 +1,3 @@
1
1
  module Rambulance
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -0,0 +1,10 @@
1
+ <html>
2
+ <head>
3
+ <title>Application page</title>
4
+ </head>
5
+ <body>
6
+ <h1>Application page</h1>
7
+
8
+ <%= yield %>
9
+ </body>
10
+ </html>
@@ -1,4 +1,6 @@
1
1
  class ExceptionsApp < Rambulance::ExceptionsApp
2
+ def not_found; end
3
+
2
4
  def internal_server_error
3
5
  render inline: <<-BODY
4
6
  <html>
@@ -38,11 +38,31 @@ feature 'Error pages' do
38
38
  page.body.should have_content "Error page"
39
39
  page.body.should have_content "Page not found."
40
40
  end
41
+
42
+ context "with a custom layout name" do
43
+ before do
44
+ @org, Rambulance.layout_name = Rambulance.layout_name, "application"
45
+ end
46
+ after { Rambulance.layout_name = @org }
47
+
48
+ scenario 'uses the custom layout' do
49
+ visit '/doesnt_exist'
50
+ page.body.should have_content "Application page"
51
+ end
52
+ end
41
53
  end
42
54
 
43
55
  context "With a custom exception app", if: ENV["CUSTOM_EXCEPTIONS_APP"] do
44
56
  it_behaves_like "an action that renders 500 page if the template is missing"
45
57
 
58
+ scenario 'Not found due to ActinoController::RoutingError' do
59
+ visit '/doesnt_exist'
60
+
61
+ page.status_code.should == 404
62
+ page.body.should have_content "Error page"
63
+ page.body.should have_content "Page not found."
64
+ end
65
+
46
66
  scenario 'Internal server error due to RuntimeError' do
47
67
  visit '/users/1'
48
68
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rambulance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Nishijima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-22 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -212,6 +212,7 @@ files:
212
212
  - spec/fake_app/app/views/errors/internal_server_error.json.jbuilder
213
213
  - spec/fake_app/app/views/errors/not_found.html.erb
214
214
  - spec/fake_app/app/views/errors/not_found.json.jbuilder
215
+ - spec/fake_app/app/views/layouts/application.html.erb
215
216
  - spec/fake_app/app/views/layouts/error.html.erb
216
217
  - spec/fake_app/lib/exceptions_app.rb
217
218
  - spec/fake_app/rails_app.rb
@@ -247,6 +248,7 @@ test_files:
247
248
  - spec/fake_app/app/views/errors/internal_server_error.json.jbuilder
248
249
  - spec/fake_app/app/views/errors/not_found.html.erb
249
250
  - spec/fake_app/app/views/errors/not_found.json.jbuilder
251
+ - spec/fake_app/app/views/layouts/application.html.erb
250
252
  - spec/fake_app/app/views/layouts/error.html.erb
251
253
  - spec/fake_app/lib/exceptions_app.rb
252
254
  - spec/fake_app/rails_app.rb