exception_handler 0.7.7.0 → 0.8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +13 -3
  3. data/.rspec +3 -0
  4. data/.travis.yml +4 -2
  5. data/Gemfile +3 -0
  6. data/README.md +330 -124
  7. data/app/assets/stylesheets/exception_handler.css.erb +5 -0
  8. data/app/assets/stylesheets/styles/_base.css.erb +1 -8
  9. data/app/assets/stylesheets/styles/_exception.css.erb +2 -1
  10. data/app/controllers/exception_handler/exceptions_controller.rb +10 -3
  11. data/app/models/exception_handler/exception.rb +21 -20
  12. data/app/views/exception_handler/exceptions/show.html.erb +1 -1
  13. data/app/views/layouts/exception.html.erb +5 -0
  14. data/app/views/layouts/mailer.html.erb +5 -0
  15. data/app/views/layouts/mailer.text.erb +1 -0
  16. data/config/locales/exception_handler.en.yml +1 -1
  17. data/config/routes.rb +42 -0
  18. data/exception_handler.gemspec +9 -8
  19. data/lib/exception_handler.rb +1 -0
  20. data/lib/exception_handler/config.rb +109 -40
  21. data/lib/exception_handler/engine.rb +11 -3
  22. data/lib/exception_handler/version.rb +2 -2
  23. data/spec/controllers/controller_spec.rb +107 -0
  24. data/spec/dummy/.rspec +1 -0
  25. data/spec/dummy/.ruby-version +1 -0
  26. data/spec/dummy/Rakefile +6 -0
  27. data/spec/dummy/app/assets/config/manifest.js +3 -0
  28. data/spec/dummy/app/assets/images/.keep +0 -0
  29. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  30. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  31. data/spec/dummy/app/assets/javascripts/channels/.keep +0 -0
  32. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  33. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  34. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  35. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  36. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  37. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  38. data/spec/dummy/app/jobs/application_job.rb +2 -0
  39. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  40. data/spec/dummy/app/models/application_record.rb +3 -0
  41. data/spec/dummy/app/models/concerns/.keep +0 -0
  42. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  43. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  44. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  45. data/spec/dummy/bin/bundle +3 -0
  46. data/spec/dummy/bin/rails +4 -0
  47. data/spec/dummy/bin/rake +4 -0
  48. data/spec/dummy/bin/setup +36 -0
  49. data/spec/dummy/bin/update +31 -0
  50. data/spec/dummy/bin/yarn +11 -0
  51. data/spec/dummy/config.ru +5 -0
  52. data/spec/dummy/config/application.rb +18 -0
  53. data/spec/dummy/config/boot.rb +5 -0
  54. data/spec/dummy/config/cable.yml +10 -0
  55. data/spec/dummy/config/database.yml +25 -0
  56. data/spec/dummy/config/environment.rb +5 -0
  57. data/spec/dummy/config/environments/development.rb +61 -0
  58. data/spec/dummy/config/environments/production.rb +94 -0
  59. data/spec/dummy/config/environments/test.rb +46 -0
  60. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  61. data/spec/dummy/config/initializers/assets.rb +14 -0
  62. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  63. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  64. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  65. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  66. data/spec/dummy/config/initializers/inflections.rb +16 -0
  67. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  68. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  69. data/spec/dummy/config/locales/en.yml +33 -0
  70. data/spec/dummy/config/puma.rb +34 -0
  71. data/spec/dummy/config/routes.rb +3 -0
  72. data/spec/dummy/config/storage.yml +34 -0
  73. data/spec/dummy/lib/assets/.keep +0 -0
  74. data/spec/dummy/log/.keep +0 -0
  75. data/spec/dummy/package.json +5 -0
  76. data/spec/dummy/public/404.html +67 -0
  77. data/spec/dummy/public/422.html +67 -0
  78. data/spec/dummy/public/500.html +66 -0
  79. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  80. data/spec/dummy/public/apple-touch-icon.png +0 -0
  81. data/spec/dummy/public/favicon.ico +0 -0
  82. data/spec/dummy/spec/rails_helper.rb +57 -0
  83. data/spec/dummy/spec/spec_helper.rb +100 -0
  84. data/spec/dummy/storage/.keep +0 -0
  85. data/spec/features/asset_spec.rb +61 -0
  86. data/spec/features/config_spec.rb +51 -0
  87. data/spec/features/engine_spec.rb +180 -0
  88. data/spec/routing/routing_spec.rb +85 -0
  89. data/spec/spec_helper.rb +93 -0
  90. data/spec/views/views_spec.rb +29 -0
  91. metadata +79 -6
  92. data/app/assets/images/exception_handler/bg.jpg +0 -0
  93. data/app/assets/images/exception_handler/bg_overlay.png +0 -0
@@ -0,0 +1,85 @@
1
+ ###############################################
2
+ ###############################################
3
+ ## _____ _ ##
4
+ ## | ___ \ | | ##
5
+ ## | |_/ /___ _ _| |_ ___ ___ ##
6
+ ## | // _ \| | | | __/ _ \/ __| ##
7
+ ## | |\ \ (_) | |_| | || __/\__ \ ##
8
+ ## \_| \_\___/ \__,_|\__\___||___/ ##
9
+ ## ##
10
+ ###############################################
11
+ ###############################################
12
+
13
+ require 'spec_helper'
14
+
15
+ ###############################################
16
+ ###############################################
17
+
18
+ # => Routes (base)
19
+ # => Test underlying routes + engine routes
20
+ RSpec.describe 'ExceptionHandler::Engine.routes' do
21
+
22
+ #############################################
23
+ #############################################
24
+
25
+ # => Let (config)
26
+ let(:dev) { ExceptionHandler.config.dev }
27
+
28
+ #############################################
29
+ #############################################
30
+
31
+ # => Rails application Routes
32
+ # => Should be routable WITH dev option
33
+ # => Should not be routable WITHOUT dev option
34
+ ['Rails.application.routes', 'ExceptionHandler::Engine.routes'].each do |item|
35
+
36
+ # => Different types of route
37
+ # => Shouldn't have any routes for engine
38
+ context item do
39
+
40
+ # => Routes
41
+ routes { eval item }
42
+
43
+ # => Dev mode
44
+ context "✔️ dev mode" do
45
+ subject { dev }
46
+ before { ExceptionHandler.config.dev = true }
47
+ before { Rails.application.reload_routes! }
48
+
49
+ it { should eq(true) }
50
+ it "has exception routes" do
51
+ Rack::Utils::SYMBOL_TO_STATUS_CODE.select{ |key, value| value.to_s.match('\b(?:4[0-9]{2}|5[0-9]{2}|599)\b') }.each do |status,code|
52
+ if item == 'Rails.application.routes'
53
+ expect(:get => code.to_s).to route_to(:controller => "exception_handler/exceptions", :action => "show", :code => status.to_sym)
54
+ else
55
+ expect(:get => code.to_s).not_to be_routable
56
+ end
57
+ end
58
+ end
59
+
60
+ end
61
+
62
+ # => Non Dev mode
63
+ context "❌ dev mode" do
64
+ subject { dev }
65
+ before { ExceptionHandler.config.dev = false }
66
+ before { Rails.application.reload_routes! }
67
+
68
+ it { should_not eq(true) }
69
+ it "does not have exception routes" do
70
+ Rack::Utils::SYMBOL_TO_STATUS_CODE.select{ |key, value| value.to_s.match('\b(?:4[0-9]{2}|5[0-9]{2}|599)\b') }.each do |status,code|
71
+ expect(:get => code.to_s).not_to be_routable
72
+ end
73
+ end
74
+
75
+ end
76
+ end
77
+ end
78
+
79
+ #############################################
80
+ #############################################
81
+
82
+ end
83
+
84
+ ###############################################
85
+ ###############################################
@@ -0,0 +1,93 @@
1
+ ###############################################
2
+ ###############################################
3
+ ## _____ _____ ##
4
+ ## | ___ \/ ___| ##
5
+ ## | |_/ /\ `--. _ __ ___ ___ ##
6
+ ## | / `--. \ '_ \ / _ \/ __| ##
7
+ ## | |\ \ /\__/ / |_) | __/ (__ ##
8
+ ## \_| \_|\____/| .__/ \___|\___| ##
9
+ ## | | ##
10
+ ## |_| ##
11
+ ###############################################
12
+ ###############################################
13
+
14
+ # => Helper
15
+ require 'spec_helper'
16
+
17
+ # => ENV
18
+ ENV["RAILS_ENV"] ||= "test"
19
+
20
+ # => Rails
21
+ require_relative './dummy/config/environment'
22
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
23
+
24
+ # => RSpec
25
+ require 'rspec/rails'
26
+
27
+ # => Environment
28
+ ActiveRecord::Migrator.migrations_paths = [File.expand_path("./dummy/db/migrate", __dir__)]
29
+
30
+ # => Gem (to test)
31
+ require 'exception_handler'
32
+
33
+ ###############################################
34
+ ###############################################
35
+
36
+ # => ActiveRecord
37
+ ActiveRecord::Migration.maintain_test_schema!
38
+
39
+ # Load fixtures from the engine
40
+ if ActiveSupport::TestCase.respond_to?(:fixture_path=)
41
+ ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__)
42
+ ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
43
+ ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + "/files"
44
+ ActiveSupport::TestCase.fixtures :all
45
+ end
46
+
47
+ ###############################################
48
+ ###############################################
49
+
50
+ #=> Custom Matchers
51
+ RSpec::Matchers.define :be_boolean do
52
+ match do |value|
53
+ [true, false].include? value
54
+ end
55
+ end
56
+
57
+ ###############################################
58
+ ###############################################
59
+
60
+ # => http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
61
+ RSpec.configure do |config|
62
+
63
+ # rspec-expectations config goes here. You can use an alternate
64
+ # assertion/expectation library such as wrong or the stdlib/minitest
65
+ # assertions if you prefer.
66
+ config.expect_with :rspec do |expectations|
67
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
68
+ expectations.syntax = :expect
69
+ end
70
+
71
+ # Enable flags like --only-failures and --next-failure
72
+ config.example_status_persistence_file_path = ".rspec_status"
73
+
74
+ # Disable RSpec exposing methods globally on `Module` and `main`
75
+ config.disable_monkey_patching!
76
+
77
+ # => Rails (Fixtures etc)
78
+ config.infer_spec_type_from_file_location!
79
+ config.filter_rails_from_backtrace!
80
+ config.order = :random
81
+
82
+ # => Asset Precompile
83
+ config.before(:suite) do
84
+ Rails.application.load_tasks
85
+ Rake::Task["assets:precompile"].invoke
86
+ end
87
+
88
+ config.after(:suite) do
89
+ Rails.application.load_tasks
90
+ Rake::Task["assets:clobber"].invoke
91
+ end
92
+
93
+ end
@@ -0,0 +1,29 @@
1
+ ###############################################
2
+ ###############################################
3
+ ## _ _ _ ##
4
+ ## | | | (_) ##
5
+ ## | | | |_ _____ _____ ##
6
+ ## | | | | |/ _ \ \ /\ / / __| ##
7
+ ## \ \_/ / | __/\ V V /\__ \ ##
8
+ ## \___/|_|\___| \_/\_/ |___/ ##
9
+ ## ##
10
+ ###############################################
11
+ ###############################################
12
+
13
+ require 'spec_helper'
14
+
15
+ ###############################################
16
+ ###############################################
17
+
18
+ # => ExceptionHandler (Views)
19
+ # => Determine views / layout for different exceptions
20
+ # => Needs to explain exactly what users is doing to see (request.status, message etc)
21
+ # => Needs to include 404/500 dev routes
22
+ RSpec.describe "ExceptionHandler Views" do
23
+
24
+
25
+
26
+ end
27
+
28
+ ###############################################
29
+ ###############################################
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7.0
4
+ version: 0.8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - R.Peck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-29 00:00:00.000000000 Z
11
+ date: 2018-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,8 @@ extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
133
  - ".gitignore"
134
+ - ".rspec"
135
+ - ".rspec_status"
134
136
  - ".slugignore"
135
137
  - ".travis.yml"
136
138
  - Gemfile
@@ -138,8 +140,6 @@ files:
138
140
  - Rakefile
139
141
  - app/assets/images/exception_handler/alert.jpg
140
142
  - app/assets/images/exception_handler/alert.png
141
- - app/assets/images/exception_handler/bg.jpg
142
- - app/assets/images/exception_handler/bg_overlay.png
143
143
  - app/assets/images/exception_handler/connect/facebook.png
144
144
  - app/assets/images/exception_handler/connect/fusion.png
145
145
  - app/assets/images/exception_handler/connect/linkedin.png
@@ -162,7 +162,10 @@ files:
162
162
  - app/views/exception_handler/mailers/layout.text.erb
163
163
  - app/views/exception_handler/mailers/new_exception.erb
164
164
  - app/views/layouts/exception.html.erb
165
+ - app/views/layouts/mailer.html.erb
166
+ - app/views/layouts/mailer.text.erb
165
167
  - config/locales/exception_handler.en.yml
168
+ - config/routes.rb
166
169
  - db/migrate/000000_create_errors.rb
167
170
  - exception_handler.gemspec
168
171
  - lib/exception_handler.rb
@@ -170,11 +173,81 @@ files:
170
173
  - lib/exception_handler/engine.rb
171
174
  - lib/exception_handler/version.rb
172
175
  - lib/generators/exception_handler/views_generator.rb
176
+ - spec/controllers/controller_spec.rb
177
+ - spec/dummy/.rspec
178
+ - spec/dummy/.ruby-version
179
+ - spec/dummy/Rakefile
180
+ - spec/dummy/app/assets/config/manifest.js
181
+ - spec/dummy/app/assets/images/.keep
182
+ - spec/dummy/app/assets/javascripts/application.js
183
+ - spec/dummy/app/assets/javascripts/cable.js
184
+ - spec/dummy/app/assets/javascripts/channels/.keep
185
+ - spec/dummy/app/assets/stylesheets/application.css
186
+ - spec/dummy/app/channels/application_cable/channel.rb
187
+ - spec/dummy/app/channels/application_cable/connection.rb
188
+ - spec/dummy/app/controllers/application_controller.rb
189
+ - spec/dummy/app/controllers/concerns/.keep
190
+ - spec/dummy/app/helpers/application_helper.rb
191
+ - spec/dummy/app/jobs/application_job.rb
192
+ - spec/dummy/app/mailers/application_mailer.rb
193
+ - spec/dummy/app/models/application_record.rb
194
+ - spec/dummy/app/models/concerns/.keep
195
+ - spec/dummy/app/views/layouts/application.html.erb
196
+ - spec/dummy/app/views/layouts/mailer.html.erb
197
+ - spec/dummy/app/views/layouts/mailer.text.erb
198
+ - spec/dummy/bin/bundle
199
+ - spec/dummy/bin/rails
200
+ - spec/dummy/bin/rake
201
+ - spec/dummy/bin/setup
202
+ - spec/dummy/bin/update
203
+ - spec/dummy/bin/yarn
204
+ - spec/dummy/config.ru
205
+ - spec/dummy/config/application.rb
206
+ - spec/dummy/config/boot.rb
207
+ - spec/dummy/config/cable.yml
208
+ - spec/dummy/config/database.yml
209
+ - spec/dummy/config/environment.rb
210
+ - spec/dummy/config/environments/development.rb
211
+ - spec/dummy/config/environments/production.rb
212
+ - spec/dummy/config/environments/test.rb
213
+ - spec/dummy/config/initializers/application_controller_renderer.rb
214
+ - spec/dummy/config/initializers/assets.rb
215
+ - spec/dummy/config/initializers/backtrace_silencers.rb
216
+ - spec/dummy/config/initializers/content_security_policy.rb
217
+ - spec/dummy/config/initializers/cookies_serializer.rb
218
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
219
+ - spec/dummy/config/initializers/inflections.rb
220
+ - spec/dummy/config/initializers/mime_types.rb
221
+ - spec/dummy/config/initializers/wrap_parameters.rb
222
+ - spec/dummy/config/locales/en.yml
223
+ - spec/dummy/config/puma.rb
224
+ - spec/dummy/config/routes.rb
225
+ - spec/dummy/config/storage.yml
226
+ - spec/dummy/lib/assets/.keep
227
+ - spec/dummy/log/.keep
228
+ - spec/dummy/package.json
229
+ - spec/dummy/public/404.html
230
+ - spec/dummy/public/422.html
231
+ - spec/dummy/public/500.html
232
+ - spec/dummy/public/apple-touch-icon-precomposed.png
233
+ - spec/dummy/public/apple-touch-icon.png
234
+ - spec/dummy/public/favicon.ico
235
+ - spec/dummy/spec/rails_helper.rb
236
+ - spec/dummy/spec/spec_helper.rb
237
+ - spec/dummy/storage/.keep
238
+ - spec/features/asset_spec.rb
239
+ - spec/features/config_spec.rb
240
+ - spec/features/engine_spec.rb
241
+ - spec/routing/routing_spec.rb
242
+ - spec/spec_helper.rb
243
+ - spec/views/views_spec.rb
173
244
  homepage: https://github.com/richpeck/exception_handler
174
245
  licenses:
175
246
  - MIT
176
247
  metadata: {}
177
- post_install_message:
248
+ post_install_message: 'ExceptionHandler 0.8.0.0 → New "config" (config.exception_handler
249
+ = {exceptions: {layout: ''x'', notification: true, action: {redirect_to root_path}
250
+ }} ). https://www.github.com/richpeck/exception_handler#config for more info. '
178
251
  rdoc_options: []
179
252
  require_paths:
180
253
  - lib
@@ -190,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
263
  version: '0'
191
264
  requirements: []
192
265
  rubyforge_project:
193
- rubygems_version: 2.6.12
266
+ rubygems_version: 2.7.6
194
267
  signing_key:
195
268
  specification_version: 4
196
269
  summary: Rails gem to show custom error pages in production. Also logs errors in db