raygun4ruby 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,6 +64,18 @@ class ConfigurationTest < Raygun::UnitTest
64
64
  assert_equal({ sally: "stegosaurus" }, Raygun.configuration.custom_data)
65
65
  end
66
66
 
67
+ def test_debug
68
+ Raygun.setup do |config|
69
+ config.debug = true
70
+ end
71
+
72
+ assert_equal Raygun.configuration.debug, true
73
+ end
74
+
75
+ def test_debug_default_set
76
+ assert_equal false, Raygun.configuration.debug
77
+ end
78
+
67
79
  def test_setting_filter_paramters_to_proc
68
80
  Raygun.setup do |config|
69
81
  config.filter_parameters do |hash|
@@ -92,4 +104,25 @@ class ConfigurationTest < Raygun::UnitTest
92
104
  Raygun.configuration.whitelist_payload_shape = nil
93
105
  end
94
106
 
107
+ def test_setting_custom_data_to_proc
108
+ Raygun.setup do |config|
109
+ config.custom_data do |exception, env|
110
+ # No-op
111
+ end
112
+ end
113
+
114
+ assert Raygun.configuration.custom_data.is_a?(Proc)
115
+ ensure
116
+ Raygun.configuration.custom_data = nil
117
+ end
118
+
119
+ def test_setting_custom_data_to_hash
120
+ Raygun.setup do |config|
121
+ config.custom_data = {}
122
+ end
123
+
124
+ assert Raygun.configuration.custom_data.is_a?(Hash)
125
+ ensure
126
+ Raygun.configuration.custom_data = nil
127
+ end
95
128
  end
@@ -2,11 +2,51 @@
2
2
  require_relative "../test_helper.rb"
3
3
  require 'stringio'
4
4
 
5
- class RaygunTest < Raygun::UnitTest
5
+ class FakeLogger
6
+ def initialize
7
+ @logger = StringIO.new
8
+ end
9
+
10
+ def info(message)
11
+ @logger.write(message)
12
+ end
13
+
14
+ def reset
15
+ @logger.string = ""
16
+ end
17
+
18
+ def get
19
+ @logger.string
20
+ end
21
+ end
6
22
 
23
+ class RaygunTest < Raygun::UnitTest
7
24
  def test_raygun_is_not_configured_with_no_api_key
8
25
  Raygun.configuration.api_key = nil
9
26
  assert !Raygun.configured?
10
27
  end
11
28
 
29
+ def test_should_report_logs_silence_reporting_when_debug_is_on
30
+ logger = setup_logging
31
+ Raygun.configuration.silence_reporting = true
32
+ Raygun.send(:should_report?, Exception.new)
33
+
34
+ assert logger.get.include?("silence_reporting"), "silence_reporting was not logged"
35
+ end
36
+
37
+ def test_should_report_logs_ignored_exceptions_when_debug_is_on
38
+ logger = setup_logging
39
+ Raygun.configuration.ignore = ["Exception"]
40
+ Raygun.send(:should_report?, Exception.new)
41
+
42
+ assert logger.get =~ /skipping reporting of.*Exception.*/, "ignored exception was not logged"
43
+ end
44
+
45
+ def setup_logging
46
+ logger = FakeLogger.new
47
+ Raygun.configuration.debug = true
48
+ Raygun.configuration.logger = logger
49
+
50
+ logger
51
+ end
12
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raygun4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindscape
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-09 00:00:00.000000000 Z
12
+ date: 2017-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -216,8 +216,10 @@ files:
216
216
  - examples/sinatras_raygun.rb
217
217
  - lib/generators/raygun/install_generator.rb
218
218
  - lib/raygun.rb
219
+ - lib/raygun/affected_user.rb
219
220
  - lib/raygun/client.rb
220
221
  - lib/raygun/configuration.rb
222
+ - lib/raygun/error.rb
221
223
  - lib/raygun/middleware/rack_exception_interceptor.rb
222
224
  - lib/raygun/middleware/rails_insert_affected_user.rb
223
225
  - lib/raygun/railtie.rb
@@ -232,9 +234,9 @@ files:
232
234
  - specs/services/apply_whitelist_filter_to_payload_spec.rb
233
235
  - test/integration/client_test.rb
234
236
  - test/test_helper.rb
237
+ - test/unit/affected_user_test.rb
235
238
  - test/unit/client_test.rb
236
239
  - test/unit/configuration_test.rb
237
- - test/unit/rails_insert_affected_user_test.rb
238
240
  - test/unit/raygun_test.rb
239
241
  - test/unit/resque_failure_test.rb
240
242
  - test/unit/sidekiq_failure_test.rb
@@ -266,9 +268,9 @@ summary: This gem provides support for Ruby and Ruby on Rails for the Raygun.io
266
268
  test_files:
267
269
  - test/integration/client_test.rb
268
270
  - test/test_helper.rb
271
+ - test/unit/affected_user_test.rb
269
272
  - test/unit/client_test.rb
270
273
  - test/unit/configuration_test.rb
271
- - test/unit/rails_insert_affected_user_test.rb
272
274
  - test/unit/raygun_test.rb
273
275
  - test/unit/resque_failure_test.rb
274
276
  - test/unit/sidekiq_failure_test.rb