exception_handler 0.8.0.0 → 0.8.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +1 -0
  4. data/.rspec +3 -3
  5. data/.travis.yml +6 -0
  6. data/README.md +327 -326
  7. data/app/views/layouts/exception.html.erb +1 -1
  8. data/app/views/layouts/mailer.html.erb +5 -5
  9. data/app/views/layouts/mailer.text.erb +1 -1
  10. data/config/locales/exception_handler.en.yml +1 -1
  11. data/config/routes.rb +42 -42
  12. data/exception_handler.gemspec +1 -0
  13. data/lib/exception_handler/version.rb +1 -1
  14. data/spec/controllers/controller_spec.rb +107 -107
  15. data/spec/dummy/Rakefile +6 -6
  16. data/spec/dummy/app/assets/config/manifest.js +3 -3
  17. data/spec/dummy/app/assets/javascripts/application.js +15 -15
  18. data/spec/dummy/app/assets/javascripts/cable.js +13 -13
  19. data/spec/dummy/app/assets/stylesheets/application.css +15 -15
  20. data/spec/dummy/app/channels/application_cable/channel.rb +4 -4
  21. data/spec/dummy/app/channels/application_cable/connection.rb +4 -4
  22. data/spec/dummy/app/controllers/application_controller.rb +2 -2
  23. data/spec/dummy/app/helpers/application_helper.rb +2 -2
  24. data/spec/dummy/app/jobs/application_job.rb +2 -2
  25. data/spec/dummy/app/mailers/application_mailer.rb +4 -4
  26. data/spec/dummy/app/models/application_record.rb +3 -3
  27. data/spec/dummy/app/views/layouts/application.html.erb +15 -15
  28. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -13
  29. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -1
  30. data/spec/dummy/bin/bundle +3 -3
  31. data/spec/dummy/bin/rails +4 -4
  32. data/spec/dummy/bin/rake +4 -4
  33. data/spec/dummy/bin/setup +36 -36
  34. data/spec/dummy/bin/update +31 -31
  35. data/spec/dummy/bin/yarn +11 -11
  36. data/spec/dummy/config.ru +5 -5
  37. data/spec/dummy/config/application.rb +18 -18
  38. data/spec/dummy/config/boot.rb +5 -5
  39. data/spec/dummy/config/cable.yml +10 -10
  40. data/spec/dummy/config/database.yml +25 -25
  41. data/spec/dummy/config/environment.rb +5 -5
  42. data/spec/dummy/config/environments/development.rb +61 -61
  43. data/spec/dummy/config/environments/production.rb +94 -94
  44. data/spec/dummy/config/environments/test.rb +46 -46
  45. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -8
  46. data/spec/dummy/config/initializers/assets.rb +14 -14
  47. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
  48. data/spec/dummy/config/initializers/content_security_policy.rb +25 -25
  49. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -5
  50. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -4
  51. data/spec/dummy/config/initializers/inflections.rb +16 -16
  52. data/spec/dummy/config/initializers/mime_types.rb +4 -4
  53. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
  54. data/spec/dummy/config/locales/en.yml +33 -33
  55. data/spec/dummy/config/puma.rb +34 -34
  56. data/spec/dummy/config/routes.rb +3 -3
  57. data/spec/dummy/config/storage.yml +34 -34
  58. data/spec/dummy/package.json +5 -5
  59. data/spec/dummy/public/404.html +67 -67
  60. data/spec/dummy/public/422.html +67 -67
  61. data/spec/dummy/public/500.html +66 -66
  62. data/spec/dummy/spec/rails_helper.rb +57 -57
  63. data/spec/features/asset_spec.rb +61 -61
  64. data/spec/features/config_spec.rb +51 -51
  65. data/spec/features/engine_spec.rb +180 -180
  66. data/spec/mailers/mailer_spec.rb +26 -0
  67. data/spec/models/model_spec.rb +26 -0
  68. data/spec/routing/routing_spec.rb +85 -85
  69. data/spec/spec_helper.rb +101 -93
  70. data/spec/views/views_spec.rb +29 -29
  71. metadata +22 -6
@@ -0,0 +1,26 @@
1
+ #####################################################
2
+ #####################################################
3
+ ## __ __ _ _ ##
4
+ ## | \/ | (_) | ##
5
+ ## | . . | __ _ _| | ___ _ __ ##
6
+ ## | |\/| |/ _` | | |/ _ \ '__| ##
7
+ ## | | | | (_| | | | __/ | ##
8
+ ## \_| |_/\__,_|_|_|\___|_| ##
9
+ ## ##
10
+ #####################################################
11
+ #####################################################
12
+
13
+ require 'spec_helper'
14
+
15
+ ###############################################
16
+ ###############################################
17
+
18
+ # => ExceptionHandler (Mailer)
19
+ # => Check veracity of methods / returned results
20
+ # =>
21
+ RSpec.describe ExceptionHandler::ExceptionMailer do
22
+
23
+ end
24
+
25
+ ###############################################
26
+ ###############################################
@@ -0,0 +1,26 @@
1
+ #####################################################
2
+ #####################################################
3
+ ## __ __ _ _ ##
4
+ ## | \/ | | | | | ##
5
+ ## | . . | ___ __| | ___| | ##
6
+ ## | |\/| |/ _ \ / _` |/ _ \ | ##
7
+ ## | | | | (_) | (_| | __/ | ##
8
+ ## \_| |_/\___/ \__,_|\___|_| ##
9
+ ## ##
10
+ #####################################################
11
+ #####################################################
12
+
13
+ require 'spec_helper'
14
+
15
+ ###############################################
16
+ ###############################################
17
+
18
+ # => ExceptionHandler (Model)
19
+ # => Check veracity of methods / returned results
20
+ # =>
21
+ RSpec.describe ExceptionHandler::Exception do
22
+
23
+ end
24
+
25
+ ###############################################
26
+ ###############################################
@@ -1,85 +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
- ###############################################
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
+ ###############################################
data/spec/spec_helper.rb CHANGED
@@ -1,93 +1,101 @@
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
1
+ ###############################################
2
+ ###############################################
3
+ ## _____ _____ ##
4
+ ## | ___ \/ ___| ##
5
+ ## | |_/ /\ `--. _ __ ___ ___ ##
6
+ ## | / `--. \ '_ \ / _ \/ __| ##
7
+ ## | |\ \ /\__/ / |_) | __/ (__ ##
8
+ ## \_| \_|\____/| .__/ \___|\___| ##
9
+ ## | | ##
10
+ ## |_| ##
11
+ ###############################################
12
+ ###############################################
13
+
14
+ # => Coveralls
15
+ # => https://docs.coveralls.io/
16
+ require 'coveralls'
17
+ Coveralls.wear!('rails')
18
+
19
+ ###############################################
20
+ ###############################################
21
+
22
+ # => Helper
23
+ require 'spec_helper'
24
+
25
+ # => ENV
26
+ ENV["RAILS_ENV"] ||= "test"
27
+
28
+ # => Rails
29
+ require_relative './dummy/config/environment'
30
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
31
+
32
+ # => RSpec
33
+ require 'rspec/rails'
34
+
35
+ # => Environment
36
+ ActiveRecord::Migrator.migrations_paths = [File.expand_path("./dummy/db/migrate", __dir__)]
37
+
38
+ # => Gem (to test)
39
+ require 'exception_handler'
40
+
41
+ ###############################################
42
+ ###############################################
43
+
44
+ # => ActiveRecord
45
+ ActiveRecord::Migration.maintain_test_schema!
46
+
47
+ # Load fixtures from the engine
48
+ if ActiveSupport::TestCase.respond_to?(:fixture_path=)
49
+ ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__)
50
+ ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
51
+ ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + "/files"
52
+ ActiveSupport::TestCase.fixtures :all
53
+ end
54
+
55
+ ###############################################
56
+ ###############################################
57
+
58
+ #=> Custom Matchers
59
+ RSpec::Matchers.define :be_boolean do
60
+ match do |value|
61
+ [true, false].include? value
62
+ end
63
+ end
64
+
65
+ ###############################################
66
+ ###############################################
67
+
68
+ # => http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
69
+ RSpec.configure do |config|
70
+
71
+ # rspec-expectations config goes here. You can use an alternate
72
+ # assertion/expectation library such as wrong or the stdlib/minitest
73
+ # assertions if you prefer.
74
+ config.expect_with :rspec do |expectations|
75
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
76
+ expectations.syntax = :expect
77
+ end
78
+
79
+ # Enable flags like --only-failures and --next-failure
80
+ config.example_status_persistence_file_path = ".rspec_status"
81
+
82
+ # Disable RSpec exposing methods globally on `Module` and `main`
83
+ config.disable_monkey_patching!
84
+
85
+ # => Rails (Fixtures etc)
86
+ config.infer_spec_type_from_file_location!
87
+ config.filter_rails_from_backtrace!
88
+ config.order = :random
89
+
90
+ # => Asset Precompile
91
+ config.before(:suite) do
92
+ Rails.application.load_tasks
93
+ Rake::Task["assets:precompile"].invoke
94
+ end
95
+
96
+ config.after(:suite) do
97
+ Rails.application.load_tasks
98
+ Rake::Task["assets:clobber"].invoke
99
+ end
100
+
101
+ end
@@ -1,29 +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
- ###############################################
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
+ ###############################################