raygun4ruby 3.2.3 → 3.2.4

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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +18 -18
  3. data/.rspec +1 -1
  4. data/.travis.yml +20 -20
  5. data/CHANGELOG.md +127 -124
  6. data/Gemfile +4 -4
  7. data/LICENSE.txt +22 -22
  8. data/README.md +420 -420
  9. data/Rakefile +27 -27
  10. data/examples/sinatras_raygun.rb +17 -17
  11. data/lib/generators/raygun/install_generator.rb +26 -26
  12. data/lib/raygun.rb +179 -179
  13. data/lib/raygun/affected_user.rb +59 -59
  14. data/lib/raygun/breadcrumbs.rb +34 -34
  15. data/lib/raygun/breadcrumbs/breadcrumb.rb +34 -34
  16. data/lib/raygun/breadcrumbs/store.rb +86 -86
  17. data/lib/raygun/client.rb +305 -305
  18. data/lib/raygun/configuration.rb +194 -194
  19. data/lib/raygun/error.rb +10 -10
  20. data/lib/raygun/javascript_tracker.rb +42 -42
  21. data/lib/raygun/middleware/breadcrumbs_store_initializer.rb +19 -19
  22. data/lib/raygun/middleware/javascript_exception_tracking.rb +32 -32
  23. data/lib/raygun/middleware/rack_exception_interceptor.rb +18 -18
  24. data/lib/raygun/middleware/rails_insert_affected_user.rb +26 -26
  25. data/lib/raygun/railtie.rb +39 -39
  26. data/lib/raygun/services/apply_whitelist_filter_to_payload.rb +27 -27
  27. data/lib/raygun/sidekiq.rb +71 -70
  28. data/lib/raygun/testable.rb +22 -22
  29. data/lib/raygun/version.rb +3 -3
  30. data/lib/raygun4ruby.rb +1 -1
  31. data/lib/resque/failure/raygun.rb +25 -25
  32. data/lib/tasks/raygun.tasks +7 -7
  33. data/raygun4ruby.gemspec +45 -45
  34. data/spec/dummy/.gitignore +17 -17
  35. data/spec/dummy/Gemfile +47 -47
  36. data/spec/dummy/README.rdoc +28 -28
  37. data/spec/dummy/Rakefile +6 -6
  38. data/spec/dummy/app/assets/config/manifest.js +2 -2
  39. data/spec/dummy/app/assets/javascripts/application.js +13 -13
  40. data/spec/dummy/app/assets/stylesheets/application.css +15 -15
  41. data/spec/dummy/app/controllers/application_controller.rb +5 -5
  42. data/spec/dummy/app/controllers/home_controller.rb +4 -4
  43. data/spec/dummy/app/helpers/application_helper.rb +2 -2
  44. data/spec/dummy/app/views/home/index.html.erb +3 -3
  45. data/spec/dummy/app/views/home/index.json.erb +1 -1
  46. data/spec/dummy/app/views/layouts/application.html.erb +14 -14
  47. data/spec/dummy/bin/bundle +3 -3
  48. data/spec/dummy/bin/rails +9 -9
  49. data/spec/dummy/bin/rake +9 -9
  50. data/spec/dummy/bin/setup +29 -29
  51. data/spec/dummy/bin/spring +17 -17
  52. data/spec/dummy/config.ru +4 -4
  53. data/spec/dummy/config/application.rb +26 -26
  54. data/spec/dummy/config/boot.rb +3 -3
  55. data/spec/dummy/config/database.yml +25 -25
  56. data/spec/dummy/config/environment.rb +5 -5
  57. data/spec/dummy/config/environments/development.rb +41 -41
  58. data/spec/dummy/config/environments/production.rb +79 -79
  59. data/spec/dummy/config/environments/test.rb +42 -42
  60. data/spec/dummy/config/initializers/assets.rb +11 -11
  61. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
  62. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -3
  63. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -4
  64. data/spec/dummy/config/initializers/inflections.rb +16 -16
  65. data/spec/dummy/config/initializers/mime_types.rb +4 -4
  66. data/spec/dummy/config/initializers/session_store.rb +3 -3
  67. data/spec/dummy/config/initializers/to_time_preserves_timezone.rb +10 -10
  68. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
  69. data/spec/dummy/config/locales/en.yml +23 -23
  70. data/spec/dummy/config/routes.rb +58 -58
  71. data/spec/dummy/config/secrets.yml +22 -22
  72. data/spec/dummy/db/seeds.rb +7 -7
  73. data/spec/dummy/public/404.html +67 -67
  74. data/spec/dummy/public/422.html +67 -67
  75. data/spec/dummy/public/500.html +66 -66
  76. data/spec/dummy/public/robots.txt +5 -5
  77. data/spec/dummy/test/test_helper.rb +10 -10
  78. data/spec/features/javascript_spec.rb +48 -48
  79. data/spec/rails_helper.rb +4 -4
  80. data/spec/raygun/breadcrumbs/breadcrumb_spec.rb +171 -171
  81. data/spec/raygun/breadcrumbs/store_spec.rb +170 -170
  82. data/spec/raygun/raygun_spec.rb +47 -47
  83. data/spec/services/apply_whitelist_filter_to_payload_spec.rb +251 -251
  84. data/spec/spec_helper.rb +24 -24
  85. data/spec/support/fake_logger.rb +17 -17
  86. data/test/integration/client_test.rb +19 -19
  87. data/test/test_helper.rb +72 -72
  88. data/test/unit/affected_user_test.rb +136 -136
  89. data/test/unit/client_test.rb +792 -792
  90. data/test/unit/configuration_test.rb +206 -206
  91. data/test/unit/raygun_test.rb +25 -25
  92. data/test/unit/resque_failure_test.rb +24 -24
  93. data/test/unit/sidekiq_failure_test.rb +32 -32
  94. metadata +7 -7
@@ -1,5 +1,5 @@
1
- # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2
- #
3
- # To ban all spiders from the entire site uncomment the next two lines:
4
- # User-agent: *
5
- # Disallow: /
1
+ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-agent: *
5
+ # Disallow: /
@@ -1,10 +1,10 @@
1
- ENV['RAILS_ENV'] ||= 'test'
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
7
- fixtures :all
8
-
9
- # Add more helper methods to be used by all tests here...
10
- end
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
7
+ fixtures :all
8
+
9
+ # Add more helper methods to be used by all tests here...
10
+ end
@@ -1,48 +1,48 @@
1
- require 'rails_helper'
2
-
3
- feature 'JavaScript Tracking', feature: true do
4
- before { Raygun.configuration.js_api_key = nil }
5
- after { Raygun.configuration.js_api_key = nil }
6
-
7
- it "Includes the Raygun Javascript Middleware" do
8
- expect(Rails.application.config.middleware).to include(Raygun::Middleware::JavascriptExceptionTracking)
9
- end
10
-
11
- it "Does not inject the JS snippet" do
12
- visit root_path
13
-
14
- expect(page.html).to_not include('cdn.raygun.io/raygun4js/raygun.min.js')
15
- expect(page.html).to_not include('rg4js(')
16
- end
17
-
18
- context 'With a JS API Key' do
19
- before { Raygun.configuration.js_api_key = 'Sample key' }
20
-
21
- it "Injects the JS snippet" do
22
- visit root_path
23
-
24
- expect(page.html).to include('cdn.raygun.io/raygun4js/raygun.min.js')
25
- expect(page.html).to include('rg4js(')
26
- end
27
-
28
- it "Does not inject the JS snippet" do
29
- visit root_path(format: :json)
30
-
31
- expect(page.html).to_not include('cdn.raygun.io/raygun4js/raygun.min.js')
32
- expect(page.html).to_not include('rg4js(')
33
- end
34
- end
35
-
36
- context "With JS version overriden" do
37
- before do
38
- Raygun.configuration.js_api_version = "2.14.1"
39
- Raygun.configuration.js_api_key = "Sample key"
40
- end
41
-
42
- it "Uses the overriden version" do
43
- visit root_path
44
-
45
- expect(page.html).to include('cdn.raygun.io/raygun4js/2.14.1/raygun.min.js')
46
- end
47
- end
48
- end
1
+ require 'rails_helper'
2
+
3
+ feature 'JavaScript Tracking', feature: true do
4
+ before { Raygun.configuration.js_api_key = nil }
5
+ after { Raygun.configuration.js_api_key = nil }
6
+
7
+ it "Includes the Raygun Javascript Middleware" do
8
+ expect(Rails.application.config.middleware).to include(Raygun::Middleware::JavascriptExceptionTracking)
9
+ end
10
+
11
+ it "Does not inject the JS snippet" do
12
+ visit root_path
13
+
14
+ expect(page.html).to_not include('cdn.raygun.io/raygun4js/raygun.min.js')
15
+ expect(page.html).to_not include('rg4js(')
16
+ end
17
+
18
+ context 'With a JS API Key' do
19
+ before { Raygun.configuration.js_api_key = 'Sample key' }
20
+
21
+ it "Injects the JS snippet" do
22
+ visit root_path
23
+
24
+ expect(page.html).to include('cdn.raygun.io/raygun4js/raygun.min.js')
25
+ expect(page.html).to include('rg4js(')
26
+ end
27
+
28
+ it "Does not inject the JS snippet" do
29
+ visit root_path(format: :json)
30
+
31
+ expect(page.html).to_not include('cdn.raygun.io/raygun4js/raygun.min.js')
32
+ expect(page.html).to_not include('rg4js(')
33
+ end
34
+ end
35
+
36
+ context "With JS version overriden" do
37
+ before do
38
+ Raygun.configuration.js_api_version = "2.14.1"
39
+ Raygun.configuration.js_api_key = "Sample key"
40
+ end
41
+
42
+ it "Uses the overriden version" do
43
+ visit root_path
44
+
45
+ expect(page.html).to include('cdn.raygun.io/raygun4js/2.14.1/raygun.min.js')
46
+ end
47
+ end
48
+ end
data/spec/rails_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- ENV['RAILS_ENV'] ||= 'test'
2
- require 'dummy/config/environment'
3
-
4
- require 'rspec/rails'
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require 'dummy/config/environment'
3
+
4
+ require 'rspec/rails'
@@ -1,171 +1,171 @@
1
- require "spec_helper"
2
-
3
- module Raygun
4
- module Breadcrumbs
5
- describe Breadcrumb do
6
- let(:subject) { Breadcrumb.new }
7
- context 'fields' do
8
- it 'has a message' do
9
- message = 'foo'
10
-
11
- subject.message = message
12
-
13
- expect(subject.message).to eq(message)
14
- end
15
-
16
- it 'has a category' do
17
- category = 'foo'
18
-
19
- subject.category = category
20
-
21
- expect(subject.category).to eq(category)
22
- end
23
-
24
- it 'has a level' do
25
- level = 'foo'
26
-
27
- subject.level = level
28
-
29
- expect(subject.level).to eq(level)
30
- end
31
-
32
- it 'has a timestamp' do
33
- timestamp = Time.now
34
-
35
- subject.timestamp = timestamp
36
-
37
- expect(subject.timestamp).to eq(timestamp)
38
- end
39
-
40
- it 'has metadata' do
41
- metadata = {foo: '1'}
42
-
43
- subject.metadata = metadata
44
-
45
- expect(subject.metadata).to eq(metadata)
46
- end
47
-
48
- it 'has a class_name' do
49
- class_name = 'foo'
50
-
51
- subject.class_name = class_name
52
-
53
- expect(subject.class_name).to eq(class_name)
54
- end
55
-
56
- it 'has a method_name' do
57
- method_name = 'foo'
58
-
59
- subject.method_name = method_name
60
-
61
- expect(subject.method_name).to eq(method_name)
62
- end
63
-
64
- it 'has a line_number' do
65
- line_number = 17
66
-
67
- subject.line_number = line_number
68
-
69
- expect(subject.line_number).to eq(line_number)
70
- end
71
- end
72
-
73
- describe "#build_payload" do
74
- before do
75
- Timecop.freeze
76
- Store.initialize
77
- end
78
- after do
79
- Timecop.return
80
- Store.clear
81
- end
82
-
83
- let(:breadcrumb) do
84
- Store.record(
85
- message: "test",
86
- category: "test",
87
- level: :info,
88
- class_name: "HomeController",
89
- method_name: "index",
90
- line_number: 17,
91
- metadata: {
92
- foo: 'bar'
93
- }
94
- )
95
-
96
- Store.stored[0]
97
- end
98
- let(:payload) { breadcrumb.build_payload }
99
-
100
- it "joins the class name, method name and line number together" do
101
- expect(payload[:location]).to eq("HomeController:index:17")
102
- end
103
-
104
- it "does not include the method name and line number if the class name is missing" do
105
- breadcrumb.class_name = nil
106
-
107
- expect(payload.has_key?(:location)).to eq(false)
108
- end
109
-
110
- it "does not inlcude the line number if is it missing" do
111
- breadcrumb.line_number = nil
112
-
113
- expect(payload[:location]).to eq("HomeController:index")
114
- end
115
-
116
- it "does not include keys in payload with nil values" do
117
- breadcrumb.metadata = nil
118
- breadcrumb.category = nil
119
-
120
- expect(payload.key?(:CustomData)).to eq(false)
121
- expect(payload.key?(:category)).to eq(false)
122
- end
123
-
124
- it 'includes the rest of the fields' do
125
- expect(payload[:message]).to eq('test')
126
- expect(payload[:category]).to eq('test')
127
- expect(payload[:level]).to eq(1)
128
- expect(payload[:timestamp]).to_not eq(nil)
129
- expect(payload[:CustomData]).to eq(foo: 'bar')
130
- end
131
- end
132
-
133
- describe "#size" do
134
- before do
135
- Timecop.freeze
136
- Store.initialize
137
- end
138
- after do
139
- Timecop.return
140
- Store.clear
141
- end
142
-
143
- let(:message) { "This is a breadcrumb message" }
144
-
145
- let(:breadcrumb) do
146
- Store.record(
147
- message: message,
148
- category: "test",
149
- level: :info,
150
- class_name: "HomeController",
151
- method_name: "index",
152
- line_number: 17,
153
- metadata: {
154
- foo: 'bar'
155
- }
156
- )
157
-
158
- Store.stored[0]
159
- end
160
-
161
- let(:size) { breadcrumb.size }
162
-
163
- it "returns the estimated size of the breadcrumb" do
164
- # Can't check all the fields but message so assume a standard 100 length for all of them
165
- # The message should be the bulk of large breadcrumbs anyway
166
- expect(size).to eq(message.length + 100)
167
- end
168
- end
169
- end
170
- end
171
- end
1
+ require "spec_helper"
2
+
3
+ module Raygun
4
+ module Breadcrumbs
5
+ describe Breadcrumb do
6
+ let(:subject) { Breadcrumb.new }
7
+ context 'fields' do
8
+ it 'has a message' do
9
+ message = 'foo'
10
+
11
+ subject.message = message
12
+
13
+ expect(subject.message).to eq(message)
14
+ end
15
+
16
+ it 'has a category' do
17
+ category = 'foo'
18
+
19
+ subject.category = category
20
+
21
+ expect(subject.category).to eq(category)
22
+ end
23
+
24
+ it 'has a level' do
25
+ level = 'foo'
26
+
27
+ subject.level = level
28
+
29
+ expect(subject.level).to eq(level)
30
+ end
31
+
32
+ it 'has a timestamp' do
33
+ timestamp = Time.now
34
+
35
+ subject.timestamp = timestamp
36
+
37
+ expect(subject.timestamp).to eq(timestamp)
38
+ end
39
+
40
+ it 'has metadata' do
41
+ metadata = {foo: '1'}
42
+
43
+ subject.metadata = metadata
44
+
45
+ expect(subject.metadata).to eq(metadata)
46
+ end
47
+
48
+ it 'has a class_name' do
49
+ class_name = 'foo'
50
+
51
+ subject.class_name = class_name
52
+
53
+ expect(subject.class_name).to eq(class_name)
54
+ end
55
+
56
+ it 'has a method_name' do
57
+ method_name = 'foo'
58
+
59
+ subject.method_name = method_name
60
+
61
+ expect(subject.method_name).to eq(method_name)
62
+ end
63
+
64
+ it 'has a line_number' do
65
+ line_number = 17
66
+
67
+ subject.line_number = line_number
68
+
69
+ expect(subject.line_number).to eq(line_number)
70
+ end
71
+ end
72
+
73
+ describe "#build_payload" do
74
+ before do
75
+ Timecop.freeze
76
+ Store.initialize
77
+ end
78
+ after do
79
+ Timecop.return
80
+ Store.clear
81
+ end
82
+
83
+ let(:breadcrumb) do
84
+ Store.record(
85
+ message: "test",
86
+ category: "test",
87
+ level: :info,
88
+ class_name: "HomeController",
89
+ method_name: "index",
90
+ line_number: 17,
91
+ metadata: {
92
+ foo: 'bar'
93
+ }
94
+ )
95
+
96
+ Store.stored[0]
97
+ end
98
+ let(:payload) { breadcrumb.build_payload }
99
+
100
+ it "joins the class name, method name and line number together" do
101
+ expect(payload[:location]).to eq("HomeController:index:17")
102
+ end
103
+
104
+ it "does not include the method name and line number if the class name is missing" do
105
+ breadcrumb.class_name = nil
106
+
107
+ expect(payload.has_key?(:location)).to eq(false)
108
+ end
109
+
110
+ it "does not inlcude the line number if is it missing" do
111
+ breadcrumb.line_number = nil
112
+
113
+ expect(payload[:location]).to eq("HomeController:index")
114
+ end
115
+
116
+ it "does not include keys in payload with nil values" do
117
+ breadcrumb.metadata = nil
118
+ breadcrumb.category = nil
119
+
120
+ expect(payload.key?(:CustomData)).to eq(false)
121
+ expect(payload.key?(:category)).to eq(false)
122
+ end
123
+
124
+ it 'includes the rest of the fields' do
125
+ expect(payload[:message]).to eq('test')
126
+ expect(payload[:category]).to eq('test')
127
+ expect(payload[:level]).to eq(1)
128
+ expect(payload[:timestamp]).to_not eq(nil)
129
+ expect(payload[:CustomData]).to eq(foo: 'bar')
130
+ end
131
+ end
132
+
133
+ describe "#size" do
134
+ before do
135
+ Timecop.freeze
136
+ Store.initialize
137
+ end
138
+ after do
139
+ Timecop.return
140
+ Store.clear
141
+ end
142
+
143
+ let(:message) { "This is a breadcrumb message" }
144
+
145
+ let(:breadcrumb) do
146
+ Store.record(
147
+ message: message,
148
+ category: "test",
149
+ level: :info,
150
+ class_name: "HomeController",
151
+ method_name: "index",
152
+ line_number: 17,
153
+ metadata: {
154
+ foo: 'bar'
155
+ }
156
+ )
157
+
158
+ Store.stored[0]
159
+ end
160
+
161
+ let(:size) { breadcrumb.size }
162
+
163
+ it "returns the estimated size of the breadcrumb" do
164
+ # Can't check all the fields but message so assume a standard 100 length for all of them
165
+ # The message should be the bulk of large breadcrumbs anyway
166
+ expect(size).to eq(message.length + 100)
167
+ end
168
+ end
169
+ end
170
+ end
171
+ end