rails_exception_handler 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.travis.yml +11 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +91 -0
  4. data/LICENCE +20 -0
  5. data/README.markdown +192 -0
  6. data/Rakefile +31 -0
  7. data/VERSION +1 -0
  8. data/app/controllers/error_response_controller.rb +6 -0
  9. data/app/models/error_message.rb +3 -0
  10. data/lib/patch/show_exceptions.rb +14 -0
  11. data/lib/rails_exception_handler/configuration.rb +13 -0
  12. data/lib/rails_exception_handler/handler.rb +69 -0
  13. data/lib/rails_exception_handler/parser.rb +73 -0
  14. data/lib/rails_exception_handler.rb +37 -0
  15. data/rails_exception_handler.gemspec +87 -0
  16. data/spec/integration/configuration_spec.rb +161 -0
  17. data/spec/integration/rails_exception_handler_spec.rb +67 -0
  18. data/spec/spec_helper.rb +25 -0
  19. data/spec/test_macros.rb +61 -0
  20. data/spec/testapp_30/.gitignore +4 -0
  21. data/spec/testapp_30/Gemfile +31 -0
  22. data/spec/testapp_30/Gemfile.lock +75 -0
  23. data/spec/testapp_30/Rakefile +7 -0
  24. data/spec/testapp_30/app/controllers/application_controller.rb +12 -0
  25. data/spec/testapp_30/app/controllers/home_controller.rb +22 -0
  26. data/spec/testapp_30/app/helpers/application_helper.rb +2 -0
  27. data/spec/testapp_30/app/models/stored_exception.rb +9 -0
  28. data/spec/testapp_30/app/views/home/view_error.html.erb +2 -0
  29. data/spec/testapp_30/app/views/layouts/fallback.html.erb +15 -0
  30. data/spec/testapp_30/app/views/layouts/home.html.erb +15 -0
  31. data/spec/testapp_30/config/application.rb +44 -0
  32. data/spec/testapp_30/config/boot.rb +6 -0
  33. data/spec/testapp_30/config/database.yml +12 -0
  34. data/spec/testapp_30/config/environment.rb +5 -0
  35. data/spec/testapp_30/config/environments/development.rb +26 -0
  36. data/spec/testapp_30/config/environments/production.rb +49 -0
  37. data/spec/testapp_30/config/environments/test.rb +35 -0
  38. data/spec/testapp_30/config/examples/database.yml +13 -0
  39. data/spec/testapp_30/config/locales/en.yml +5 -0
  40. data/spec/testapp_30/config/routes.rb +6 -0
  41. data/spec/testapp_30/config.ru +4 -0
  42. data/spec/testapp_30/db/migrate/20110630174538_create_error_messages.rb +22 -0
  43. data/spec/testapp_30/db/migrate/20110702131654_add_sessions_table.rb +16 -0
  44. data/spec/testapp_30/db/schema.rb +39 -0
  45. data/spec/testapp_30/db/seeds.rb +7 -0
  46. data/spec/testapp_30/lib/tasks/.gitkeep +0 -0
  47. data/spec/testapp_30/script/rails +6 -0
  48. data/spec/testapp_30/script/setup +19 -0
  49. data/spec/testapp_30/vendor/plugins/.gitkeep +0 -0
  50. data/spec/unit/configuration_spec.rb +37 -0
  51. data/spec/unit/handler_spec.rb +136 -0
  52. data/spec/unit/parser_spec.rb +112 -0
  53. metadata +107 -0
@@ -0,0 +1,161 @@
1
+ require File.expand_path(File.dirname(__FILE__)) + '/../spec_helper.rb'
2
+
3
+ describe RailsExceptionHandler::Configuration do
4
+ describe ".storage_strategies" do
5
+ it "should store errors in the database when storage_strategies contains :active_record" do
6
+ RailsExceptionHandler.configure { |config| config.storage_strategies = [:active_record] }
7
+ get('/incorrect_route')
8
+ ErrorMessage.count.should == 1
9
+ end
10
+
11
+ it "should store errors in the rails log when storage_strategies contains :rails_log" do
12
+ RailsExceptionHandler.configure { |config| config.storage_strategies = [:rails_log] }
13
+ get('/home/model_error')
14
+ read_test_log.should match /NoMethodError \(undefined method `foo' for nil:NilClass\)/
15
+ read_test_log.should match /lib\/active_support\/whiny_nil\.rb:48/
16
+ read_test_log.should match /PARAMS:\s+{\"controller\"=>\"home\", \"action\"=>\"model_error\"}/
17
+ read_test_log.should match /TARGET:\s+http:\/\/example\.org\/home\/model_error/
18
+ end
19
+
20
+ # No idea how to integration test remote_url without spawning a dedicated test server
21
+ end
22
+
23
+ describe '.filters' do
24
+ describe ":all_404s" do
25
+ it "should ignore routing errors when the filters contains :all_404s" do
26
+ RailsExceptionHandler.configure { |config| config.filters = [:all_404s]}
27
+ get('/incorrect_route')
28
+ ErrorMessage.count.should == 0
29
+ end
30
+
31
+ it "should not ignore routing errors when the filters doesnt contain :all_404s" do
32
+ RailsExceptionHandler.configure { |config| config.filters = []}
33
+ get('/incorrect_route')
34
+ ErrorMessage.count.should == 1
35
+ end
36
+ end
37
+
38
+ describe ":no_referer_404s" do
39
+ it "should not store a routing error that contains a referer" do
40
+ RailsExceptionHandler.configure { |config| config.filters = [:no_referer_404s]}
41
+ get "/incorrect_route"
42
+ ErrorMessage.count.should == 0
43
+ end
44
+
45
+ it "should store a routing error that has a referer" do
46
+ RailsExceptionHandler.configure { |config| config.filters = [:no_referer_404s]}
47
+ get "/incorrect_route", {}, {'HTTP_REFERER' => 'http://example.com'}
48
+ ErrorMessage.count.should == 1
49
+ end
50
+
51
+ it "should store a non routing error without referer" do
52
+ RailsExceptionHandler.configure { |config| config.filters = [:no_referer_404s]}
53
+ get "/home/view_error"
54
+ ErrorMessage.count.should == 1
55
+ end
56
+ end
57
+
58
+ describe ":user_agent_regxp" do
59
+ it "should not store the error message when the user agent matches this regxp" do
60
+ RailsExceptionHandler.configure { |config| config.filters = [:user_agent_regxp => /\b(NaughtyBot)\b/]}
61
+ get "/incorrect_route", {}, {'HTTP_USER_AGENT' => 'I am a NaughtyBot'}
62
+ ErrorMessage.count.should == 0
63
+ end
64
+
65
+ it "should store the error message when the user agent doesnt match this regxp" do
66
+ RailsExceptionHandler.configure { |config| config.filters = [:user_agent_regxp => /\b(NaughtyBot)\b/]}
67
+ get "/incorrect_route", {}, {'HTTP_USER_AGENT' => "Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0"}
68
+ ErrorMessage.count.should == 1
69
+ end
70
+ end
71
+
72
+ describe ":target_url_regxp" do
73
+ it "should not store the error message when the url matches this regxp" do
74
+ RailsExceptionHandler.configure { |config| config.filters = [:target_url_regxp => /incorrect/]}
75
+ get "/incorrect_route"
76
+ ErrorMessage.count.should == 0
77
+ end
78
+
79
+ it "should store the error message when the url doesnt matche this regxp" do
80
+ RailsExceptionHandler.configure { |config| config.filters = [:target_url_regxp => /\b(phpMyAdmin)\b/]}
81
+ get "/incorrect_route"
82
+ ErrorMessage.count.should == 1
83
+ end
84
+ end
85
+ end
86
+
87
+ describe ".environments" do
88
+ it "should not log routing errors if the current rails environment is not included" do
89
+ Rails.configuration.middleware.delete RailsExceptionHandler
90
+ RailsExceptionHandler.configure { |config| config.environments = [:production] }
91
+ lambda { get('/incorrect_route') }.should raise_exception
92
+ ErrorMessage.count.should == 0
93
+ end
94
+
95
+ it "should not log regular errors if the current rails environment is not included" do
96
+ Rails.configuration.middleware.delete RailsExceptionHandler
97
+ RailsExceptionHandler.configure { |config| config.environments = [:production] }
98
+ lambda { get('/home/model_error') }.should raise_exception
99
+ ErrorMessage.count.should == 0
100
+ end
101
+
102
+ it "should log routing errors if the rails environment is included" do
103
+ Rails.configuration.middleware.delete RailsExceptionHandler
104
+ RailsExceptionHandler.configure { |config| config.environments = [Rails.env.to_sym] }
105
+ get('/incorrect_route')
106
+ ErrorMessage.count.should == 1
107
+ last_response.body.should match(/this_is_the_fallback_layout/)
108
+ end
109
+
110
+ it "should log regular errors if the rails environment is included" do
111
+ Rails.configuration.middleware.delete RailsExceptionHandler
112
+ RailsExceptionHandler.configure { |config| config.environments = [Rails.env.to_sym] }
113
+ get('/home/model_error')
114
+ ErrorMessage.count.should == 1
115
+ last_response.body.should match(/this_is_the_home_layout/)
116
+ end
117
+ end
118
+
119
+ describe ".fallback_layout" do
120
+ it "should use the supplied layout on routing errors" do
121
+ RailsExceptionHandler.configure { |config| config.fallback_layout = 'home' }
122
+ get('/incorrect_route')
123
+ last_response.body.should match(/this_is_the_home_layout/)
124
+ end
125
+ end
126
+
127
+ describe ".store_user_info" do
128
+ it "should not store user info when disbled" do
129
+ RailsExceptionHandler.configure do |config|
130
+ config.environments = [Rails.env.to_sym]
131
+ config.storage_strategies = [:active_record]
132
+ config.store_user_info = nil
133
+ end
134
+ get('/incorrect_route')
135
+ ErrorMessage.count.should == 1
136
+ ErrorMessage.first.user_info.should == nil
137
+ end
138
+
139
+ it "should store user info on routing errors" do
140
+ RailsExceptionHandler.configure do |config|
141
+ config.environments = [Rails.env.to_sym]
142
+ config.storage_strategies = [:active_record]
143
+ config.store_user_info = {:method => :current_user, :field => :login}
144
+ end
145
+ get('/incorrect_route')
146
+ ErrorMessage.count.should == 1
147
+ ErrorMessage.first.user_info.should == 'matz'
148
+ end
149
+
150
+ it "should store user info on application errors" do
151
+ RailsExceptionHandler.configure do |config|
152
+ config.environments = [Rails.env.to_sym]
153
+ config.storage_strategies = [:active_record]
154
+ config.store_user_info = {:method => :current_user, :field => :login}
155
+ end
156
+ get('/home/view_error')
157
+ ErrorMessage.count.should == 1
158
+ ErrorMessage.first.user_info.should == 'matz'
159
+ end
160
+ end
161
+ end
@@ -0,0 +1,67 @@
1
+ require File.expand_path(File.dirname(__FILE__)) + '/../spec_helper.rb'
2
+
3
+ describe RailsExceptionHandler do
4
+ it "should catch controller errors" do
5
+ get "/home/controller_error"
6
+ ErrorMessage.count.should == 1
7
+ last_response.body.should match(/Internal server error/)
8
+ ErrorMessage.first.class_name.should == 'NoMethodError'
9
+ end
10
+
11
+ it "should catch model errors" do
12
+ get "/home/model_error"
13
+ ErrorMessage.count.should == 1
14
+ last_response.body.should match(/Internal server error/)
15
+ ErrorMessage.first.class_name.should == 'NoMethodError'
16
+ end
17
+
18
+ it "should catch view errors" do
19
+ get "/home/view_error"
20
+ ErrorMessage.count.should == 1
21
+ last_response.body.should match(/Internal server error/)
22
+ ErrorMessage.first.class_name.should == 'ActionView::Template::Error'
23
+ end
24
+
25
+ it "should catch routing errors" do
26
+ get "/incorrect_route"
27
+ ErrorMessage.count.should == 1
28
+ last_response.body.should match(/Page not found/)
29
+ ErrorMessage.first.class_name.should == 'ActionController::RoutingError'
30
+ end
31
+
32
+ it "should catch syntax errors" do
33
+ get "/home/syntax_error"
34
+ ErrorMessage.count.should == 1
35
+ last_response.body.should match(/Internal server error/)
36
+ ErrorMessage.first.class_name.should == 'SyntaxError'
37
+ end
38
+
39
+ it "should append the failed controllers view layout when rendering the response" do
40
+ get "/home/view_error"
41
+ last_response.body.should match(/this_is_the_home_layout/)
42
+ end
43
+
44
+ it "should fall back to using the application layout on routing errors" do
45
+ get "/incorrect_route"
46
+ last_response.body.should match(/this_is_the_fallback_layout/)
47
+ end
48
+
49
+ it "should store the correct information in the database" do
50
+ RailsExceptionHandler.configure { |config| config.store_user_info = {:method => :current_user, :field => :login} }
51
+ get "/home/controller_error", {}, {'HTTP_REFERER' => 'http://google.com/', 'HTTP_USER_AGENT' => 'Mozilla/4.0 (compatible; MSIE 8.0)'}
52
+ ErrorMessage.count.should == 1
53
+ msg = ErrorMessage.first
54
+ msg.app_name.should == 'ExceptionHandlerTestApp'
55
+ msg.class_name.should == 'NoMethodError'
56
+ msg.message.should == "undefined method `foo' for nil:NilClass"
57
+ msg.trace.should match /#{TEST_APP}\/app\/controllers\/home_controller.rb:5:in `controller_error'/
58
+ msg.params.should match /"controller"=>"home"/
59
+ msg.params.should match /"action"=>"controller_error"/
60
+ msg.user_agent.should == 'Mozilla/4.0 (compatible; MSIE 8.0)'
61
+ msg.target_url.should == 'http://example.org/home/controller_error'
62
+ msg.referer_url.should == 'http://google.com/'
63
+ msg.user_info.should == 'matz'
64
+ msg.created_at.should be > 5.seconds.ago
65
+ msg.created_at.should be < Time.now
66
+ end
67
+ end
@@ -0,0 +1,25 @@
1
+
2
+ TEST_APP = 'testapp_30'
3
+ ENV["RAILS_ENV"] = 'test'
4
+ require File.expand_path(File.dirname(__FILE__)) + "/#{TEST_APP}/config/environment.rb"
5
+
6
+ require File.expand_path(File.dirname(__FILE__)) + '/test_macros.rb'
7
+
8
+ require "rspec/rails"
9
+ require "rack/test"
10
+
11
+ ActiveRecord::Base.logger = nil
12
+ ActionController::Base.logger = nil
13
+
14
+ RSpec.configure do |config|
15
+ config.include Rack::Test::Methods
16
+ config.include TestMacros
17
+ config.around do |example|
18
+ ErrorMessage.delete_all
19
+ clear_test_log
20
+ reset_configuration
21
+ example.call
22
+ end
23
+ config.color_enabled = true
24
+ config.full_backtrace = true
25
+ end
@@ -0,0 +1,61 @@
1
+
2
+ require 'fileutils'
3
+
4
+ module TestMacros
5
+ def app # Used by by Rack::Test to get the application object
6
+ Rails.application.app
7
+ end
8
+
9
+ def create_env(*args)
10
+ options = args.extract_options!
11
+ referer = options[:referer] || 'http://google.com/'
12
+ s = Rack::Test::Session.new(nil)
13
+ env = s.send(:env_for,'/home', {:params => {:foo => 'bar'}, 'HTTP_REFERER' => referer, 'HTTP_USER_AGENT' => "Mozilla/4.0 (compatible; MSIE 8.0)"})
14
+ end
15
+
16
+ def create_parser(exception = nil, request = nil, controller = nil)
17
+ env = create_env
18
+ controller ||= mock(ApplicationController, :current_user => mock(Object, :login => 'matz'))
19
+ request ||= ActionDispatch::Request.new(env)
20
+ exception ||= create_exception
21
+ parser = RailsExceptionHandler::Parser.new(exception, request, controller)
22
+ end
23
+
24
+ def create_exception
25
+ exception = nil
26
+ begin
27
+ nil.foo
28
+ rescue Exception => e
29
+ exception = e
30
+ end
31
+ end
32
+
33
+ def clear_test_log
34
+ File.open(log_path, 'w') {|f| f.write('') }
35
+ end
36
+
37
+ def read_test_log
38
+ data = ""
39
+ File.open(log_path, 'r').each_line do |line|
40
+ data += line + '\n'
41
+ end
42
+ return data
43
+ end
44
+
45
+ def reset_configuration
46
+ Rails.configuration.middleware.delete(RailsExceptionHandler)
47
+ RailsExceptionHandler.configure do |config|
48
+ config.storage_strategies = [:active_record]
49
+ config.environments = [:test]
50
+ config.store_user_info = false
51
+ config.filters = []
52
+ config.fallback_layout = 'fallback'
53
+ end
54
+ end
55
+
56
+ private
57
+
58
+ def log_path
59
+ File.expand_path(File.dirname(__FILE__)) + "/#{TEST_APP}/log/test.log"
60
+ end
61
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/
@@ -0,0 +1,31 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.0.9'
4
+
5
+ # Bundle edge Rails instead:
6
+ # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
+
8
+ gem 'mysql2'
9
+
10
+ # Use unicorn as the web server
11
+ # gem 'unicorn'
12
+
13
+ # Deploy with Capistrano
14
+ # gem 'capistrano'
15
+
16
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
17
+ # gem 'ruby-debug'
18
+ # gem 'ruby-debug19', :require => 'ruby-debug'
19
+
20
+ # Bundle the extra gems:
21
+ # gem 'bj'
22
+ # gem 'nokogiri'
23
+ # gem 'sqlite3-ruby', :require => 'sqlite3'
24
+ # gem 'aws-s3', :require => 'aws/s3'
25
+
26
+ # Bundle gems for the local environment. Make sure to
27
+ # put test-only gems in this group so their generators
28
+ # and rake tasks are available in development mode:
29
+ # group :development, :test do
30
+ # gem 'webrat'
31
+ # end
@@ -0,0 +1,75 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionmailer (3.0.9)
6
+ actionpack (= 3.0.9)
7
+ mail (~> 2.2.19)
8
+ actionpack (3.0.9)
9
+ activemodel (= 3.0.9)
10
+ activesupport (= 3.0.9)
11
+ builder (~> 2.1.2)
12
+ erubis (~> 2.6.6)
13
+ i18n (~> 0.5.0)
14
+ rack (~> 1.2.1)
15
+ rack-mount (~> 0.6.14)
16
+ rack-test (~> 0.5.7)
17
+ tzinfo (~> 0.3.23)
18
+ activemodel (3.0.9)
19
+ activesupport (= 3.0.9)
20
+ builder (~> 2.1.2)
21
+ i18n (~> 0.5.0)
22
+ activerecord (3.0.9)
23
+ activemodel (= 3.0.9)
24
+ activesupport (= 3.0.9)
25
+ arel (~> 2.0.10)
26
+ tzinfo (~> 0.3.23)
27
+ activeresource (3.0.9)
28
+ activemodel (= 3.0.9)
29
+ activesupport (= 3.0.9)
30
+ activesupport (3.0.9)
31
+ arel (2.0.10)
32
+ builder (2.1.2)
33
+ erubis (2.6.6)
34
+ abstract (>= 1.0.0)
35
+ i18n (0.5.0)
36
+ mail (2.2.19)
37
+ activesupport (>= 2.3.6)
38
+ i18n (>= 0.4.0)
39
+ mime-types (~> 1.16)
40
+ treetop (~> 1.4.8)
41
+ mime-types (1.16)
42
+ mysql2 (0.3.6)
43
+ polyglot (0.3.1)
44
+ rack (1.2.3)
45
+ rack-mount (0.6.14)
46
+ rack (>= 1.0.0)
47
+ rack-test (0.5.7)
48
+ rack (>= 1.0)
49
+ rails (3.0.9)
50
+ actionmailer (= 3.0.9)
51
+ actionpack (= 3.0.9)
52
+ activerecord (= 3.0.9)
53
+ activeresource (= 3.0.9)
54
+ activesupport (= 3.0.9)
55
+ bundler (~> 1.0)
56
+ railties (= 3.0.9)
57
+ railties (3.0.9)
58
+ actionpack (= 3.0.9)
59
+ activesupport (= 3.0.9)
60
+ rake (>= 0.8.7)
61
+ rdoc (~> 3.4)
62
+ thor (~> 0.14.4)
63
+ rake (0.9.2)
64
+ rdoc (3.8)
65
+ thor (0.14.6)
66
+ treetop (1.4.9)
67
+ polyglot (>= 0.3.1)
68
+ tzinfo (0.3.29)
69
+
70
+ PLATFORMS
71
+ ruby
72
+
73
+ DEPENDENCIES
74
+ mysql2
75
+ rails (= 3.0.9)
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ ExceptionHandlerTestApp::Application.load_tasks
@@ -0,0 +1,12 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+
4
+ def current_user
5
+ mock = Object.new
6
+ def mock.login
7
+ 'matz'
8
+ end
9
+ return mock
10
+ end
11
+
12
+ end
@@ -0,0 +1,22 @@
1
+ class HomeController < ApplicationController
2
+ layout 'home'
3
+
4
+ def controller_error
5
+ nil.foo
6
+ render(:text => 'did not fail')
7
+ end
8
+
9
+ def model_error
10
+ s = StoredException.new
11
+ s.failure
12
+ render(:text => 'did not fail')
13
+ end
14
+
15
+ def view_error
16
+ end
17
+
18
+ def syntax_error
19
+ eval("arr = [")
20
+ render(:text => 'did not fail')
21
+ end
22
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,9 @@
1
+ # Only used for testing model errors
2
+ class StoredException < ActiveRecord::Base
3
+ set_table_name :error_messages
4
+
5
+
6
+ def failure
7
+ nil.foo
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+
2
+ <%= nil.foo %>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>ExceptionHandlerTestApp</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ this_is_the_fallback_layout
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>ExceptionHandlerTestApp</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ this_is_the_home_layout
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,44 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module ExceptionHandlerTestApp
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Custom directories with classes and modules you want to be autoloadable.
16
+ # config.autoload_paths += %W(#{config.root}/extras)
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named.
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running.
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+
29
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
+ # config.i18n.default_locale = :de
32
+
33
+ # JavaScript files you want as :defaults (application.js is always included).
34
+ config.action_view.javascript_expansions[:defaults] = []
35
+
36
+ # Configure the default encoding used in templates for Ruby 1.9.
37
+ config.encoding = "utf-8"
38
+
39
+ # Configure sensitive parameters which will be filtered from the log file.
40
+ config.filter_parameters += [:password]
41
+
42
+ config.session_store :active_record_store
43
+ end
44
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,12 @@
1
+ test: &test
2
+ adapter: mysql2
3
+ encoding: utf8
4
+ reconnect: false
5
+ database: exception_handler_test_app_test
6
+ pool: 5
7
+ username: root
8
+ password: admin
9
+ socket: /var/run/mysqld/mysqld.sock
10
+
11
+ exception_database:
12
+ <<: *test
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ ExceptionHandlerTestApp::Application.initialize!
@@ -0,0 +1,26 @@
1
+ ExceptionHandlerTestApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+ end
26
+
@@ -0,0 +1,49 @@
1
+ ExceptionHandlerTestApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+ end