errdo 0.11.1 → 0.11.2

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.
@@ -0,0 +1,64 @@
1
+ require 'test_helper'
2
+
3
+ class FailJob < ActiveJob::Base
4
+
5
+ queue_as :default
6
+
7
+ def perform(*_args)
8
+ raise "AsynchronousFailure"
9
+ end
10
+
11
+ end
12
+
13
+ class NonWebTest < ActionDispatch::IntegrationTest
14
+
15
+ # rubocop:disable Style/RescueModifier
16
+ # rubocop:disable Lint/HandleExceptions
17
+ context "rake tasks" do
18
+ setup do
19
+ load "#{Rails.root}/lib/tasks/test.rake"
20
+ end
21
+
22
+ teardown do
23
+ Rake.application['test:error'].reenable
24
+ Rake.application['test:interrupt'].reenable
25
+ end
26
+
27
+ should "create an error when a task fails" do
28
+ Errdo.log_task_exceptions = true
29
+ assert_difference 'Errdo::ErrorOccurrence.count', 1 do
30
+ Rake.application['test:error'].invoke rescue ""
31
+ end
32
+ end
33
+
34
+ should "not create an error when a task fails with an interrupt" do
35
+ Errdo.log_task_exceptions = true
36
+ load "#{Rails.root}/lib/tasks/test.rake"
37
+ assert_difference 'Errdo::ErrorOccurrence.count', 0 do
38
+ begin
39
+ Rake.application['test:interrupt'].invoke
40
+ rescue Interrupt
41
+ end
42
+ end
43
+ end
44
+
45
+ should "create not an error when a task fails when not set" do
46
+ Errdo.log_task_exceptions = false
47
+ assert_difference 'Errdo::ErrorOccurrence.count', 0 do
48
+ Rake.application['test:error'].invoke rescue ""
49
+ end
50
+ end
51
+ end
52
+ # rubocop:enable Style/RescueModifier
53
+ # rubocop:enable Lint/HandleExceptions
54
+
55
+ context "active jobs" do
56
+ should "log to errdo when job fails asynchronously" do
57
+ assert_difference 'Errdo::ErrorOccurrence.count', 1 do
58
+ # rubocop:disable Style/RescueModifier
59
+ FailJob.perform_now rescue ""
60
+ end
61
+ end
62
+ end
63
+
64
+ end
@@ -83,46 +83,6 @@ class ErrdoTest < ActiveSupport::TestCase
83
83
  occ = Errdo::ErrorOccurrence.last
84
84
  assert_equal "...", occ.param_values[:password]
85
85
  end
86
-
87
- # rubocop:disable Style/RescueModifier
88
- # rubocop:disable Lint/HandleExceptions
89
- context "rake tasks" do
90
- setup do
91
- load "#{Rails.root}/lib/tasks/test.rake"
92
- end
93
-
94
- teardown do
95
- Rake.application['test:error'].reenable
96
- Rake.application['test:interrupt'].reenable
97
- end
98
-
99
- should "create an error when a task fails" do
100
- Errdo.log_task_exceptions = true
101
- assert_difference 'Errdo::ErrorOccurrence.count', 1 do
102
- Rake.application['test:error'].invoke rescue ""
103
- end
104
- end
105
-
106
- should "not create an error when a task fails with an interrupt" do
107
- Errdo.log_task_exceptions = true
108
- load "#{Rails.root}/lib/tasks/test.rake"
109
- assert_difference 'Errdo::ErrorOccurrence.count', 0 do
110
- begin
111
- Rake.application['test:interrupt'].invoke
112
- rescue Interrupt
113
- end
114
- end
115
- end
116
-
117
- should "create not an error when a task fails when not set" do
118
- Errdo.log_task_exceptions = false
119
- assert_difference 'Errdo::ErrorOccurrence.count', 0 do
120
- Rake.application['test:error'].invoke rescue ""
121
- end
122
- end
123
- end
124
- # rubocop:enable Style/RescueModifier
125
- # rubocop:enable Lint/HandleExceptions
126
86
  end
127
87
  end
128
88
 
@@ -0,0 +1,4 @@
1
+ module Dummy
2
+ class Application
3
+ end
4
+ end
@@ -0,0 +1,54 @@
1
+ Errdo.setup do |config|
2
+ # Add words to be scrubbed from the params here. By default, this is
3
+ # %w(password passwd password_confirmation secret confirm_password secret_token)
4
+ # So make sure you add on, not replace!
5
+ # Errdo.dirty_words += ["custom_param"]
6
+
7
+ ## == Authorization and Devise integration =========
8
+ # If you have the ability to track who's logged in, setting the current_user_method
9
+ # will allow the logged-in user to be recorded with the error
10
+ # config.current_user_method = :current_user
11
+ # Some form of authentication here is basically necessary for authorization
12
+ # config.authenticate_with do
13
+ # warden.authenticate! scope: :user
14
+ # end
15
+
16
+ ## == Authorization ================================
17
+ # Setup authorization to be run as a before filter
18
+ # This is run inside the controller instance so you can setup any authorization you need to.
19
+ # By default, there is no authorization.
20
+ #
21
+ # config.authorize_with do
22
+ # redirect_to root_path unless warden.user.try(:is_admin?)
23
+ # end
24
+ #
25
+ # To use an authorization adapter, pass the name of the adapter. For example,
26
+ # to use with CanCanCan[https://github.com/CanCanCommunity/cancancan], pass it like this.
27
+ # Currently, only cancan/cancancan is supported
28
+ # config.authorize_with :cancan
29
+
30
+ # This determines how the user is displayed on the table of errors
31
+ # Can be any method that a user responds to, I.E. Any method that returns a string
32
+ # when called on user (Default is :email)
33
+ config.user_string_method = :email
34
+
35
+ # Setting this will allow the user string to be linked to the show path
36
+ # Default is the errdo root path
37
+ # config.user_show_path = :user_path
38
+
39
+ ## == Notification Integration ====================
40
+ # See the github page at https://github.com/erichaydel/errdo for more info on how to set up slack
41
+ # If you want to set up slack, this is the only required parameter.
42
+ # The rest are totally optional, and default to the values here
43
+ #
44
+ # Errdo.notify_with slack: { webhook: "WEBHOOK-URL",
45
+ # channel: nil
46
+ # icon: ":boom:",
47
+ # name: "Errdo-bot" }
48
+ # For now, slack is the only integration. More coming soon!
49
+
50
+ ## == Non Web Requests ============================
51
+ # Error logging for rake tasks is on by default. To turn it off, set
52
+ # Errdo.log_task_exceptions = false
53
+
54
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errdo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - erichaydel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-20 00:00:00.000000000 Z
11
+ date: 2016-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -158,6 +158,7 @@ files:
158
158
  - app/views/layouts/errdo/application.html.slim
159
159
  - config/routes.rb
160
160
  - lib/errdo.rb
161
+ - lib/errdo/active_job.rb
161
162
  - lib/errdo/engine.rb
162
163
  - lib/errdo/extension.rb
163
164
  - lib/errdo/extensions/cancancan.rb
@@ -1001,13 +1002,15 @@ files:
1001
1002
  - test/helpers/views_helper_test.rb
1002
1003
  - test/integrations/authorization_integration_test.rb
1003
1004
  - test/integrations/errors_integration_test.rb
1005
+ - test/integrations/non_web_test.rb
1004
1006
  - test/integrations/plugins_integration_test.rb
1005
1007
  - test/integrations/views_integration_test.rb
1006
1008
  - test/models/errdo_test.rb
1007
1009
  - test/models/error_occurrence_test.rb
1008
1010
  - test/models/error_test.rb
1009
1011
  - test/test_helper.rb
1010
- - test/tmp/db/migrate/20161020165703_errdo_create_errs.rb
1012
+ - test/tmp/config/application.rb
1013
+ - test/tmp/config/initializers/errdo.rb
1011
1014
  homepage: https://github.com/erichaydel/errdo
1012
1015
  licenses:
1013
1016
  - MIT
@@ -1848,6 +1851,7 @@ test_files:
1848
1851
  - test/dummy/app/views/users/show.html.erb
1849
1852
  - test/dummy/app/views/static/log.html.erb
1850
1853
  - test/dummy/app/views/static/home.html.erb
1854
+ - test/integrations/non_web_test.rb
1851
1855
  - test/integrations/errors_integration_test.rb
1852
1856
  - test/integrations/views_integration_test.rb
1853
1857
  - test/integrations/plugins_integration_test.rb
@@ -1860,7 +1864,8 @@ test_files:
1860
1864
  - test/models/error_occurrence_test.rb
1861
1865
  - test/models/errdo_test.rb
1862
1866
  - test/models/error_test.rb
1863
- - test/tmp/db/migrate/20161020165703_errdo_create_errs.rb
1867
+ - test/tmp/config/application.rb
1868
+ - test/tmp/config/initializers/errdo.rb
1864
1869
  - test/generators/install_generator_test.rb
1865
1870
  - test/generators/active_record_generator_test.rb
1866
1871
  - test/generators/errdo_generator_test.rb
@@ -1,54 +0,0 @@
1
- class ErrdoCreateErrs < ActiveRecord::Migration
2
- def change
3
- create_table :errs do |t|
4
- t.string :exception_class_name
5
- t.string :exception_message
6
- t.string :http_method
7
- t.string :host_name
8
- t.string :url
9
-
10
- t.text :backtrace
11
-
12
- t.string :backtrace_hash
13
- t.integer :occurrence_count, default: 0
14
- t.datetime :last_occurred_at
15
-
16
- t.string :last_experiencer_type
17
- t.integer :last_experiencer_id
18
-
19
- t.integer :status, default: 0
20
- t.string :importance, default: "error"
21
-
22
-
23
- t.timestamps null: false
24
- end
25
-
26
- create_table :err_occurrences do |t|
27
- t.integer :err_id
28
-
29
- t.string :experiencer_type
30
- t.integer :experiencer_id
31
-
32
- t.string :ip
33
- t.string :user_agent
34
- t.string :referer
35
- t.string :query_string
36
- t.text :form_values
37
- t.text :param_values
38
- t.text :cookie_values
39
- t.text :header_values
40
-
41
- t.integer :ocurrence_count, default: 1
42
- t.timestamps null: false
43
- end
44
-
45
- add_index :errs, :backtrace_hash, unique: true
46
- add_index :errs, :importance
47
- add_index :errs, :last_experiencer_id
48
- add_index :errs, :last_experiencer_type
49
-
50
- add_index :err_occurrences, :experiencer_id
51
- add_index :err_occurrences, :experiencer_type
52
- add_index :err_occurrences, :err_id
53
- end
54
- end