hoodoo 2.12.10 → 3.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30bf5e509bdb3b77d138232a8c747b7af491f784d2bf6151d58b5911d2a1de32
4
- data.tar.gz: 50024b0acdc5959e04637b301c8c39729f18bd23a7d5a64ebcaf96c929eb07be
3
+ metadata.gz: 1c072388050450a0f03e3956b313c1a58b5a29eaec761ceb5098f81ee2ea7d2f
4
+ data.tar.gz: e78949d826d84ce23b84e6d024955403278f72bf161d12771a703664b53e1c7c
5
5
  SHA512:
6
- metadata.gz: de8c9c12dec808ee0b8d5b05c45bd2c6c31175f04fb2d5cb96f37112fd7b51fa8600016f82c44934677a7f913b19f472cf16d2bcd3603817f3eae54073a88e3e
7
- data.tar.gz: fd80735a9d0c4e74a38f3f2c2ad5a30ae913ec6fbcd84ce9cc83da6b545164ef4b1022ccdca32305e62a40693a8a25e9ff95a76eda9f3ccf27318ad084b4d28d
6
+ metadata.gz: 65f5ba41ed0210152f9ad5784dfa587745ce403d6695a56eb440d1ed47f98c03fbba861f1f7815378487532a763f59f22c2e462c1c69c84041e9fa73d77bb7f5
7
+ data.tar.gz: 66d79b81ec7a9bc431bf5f7c9a3f934b840a9e172547402389d4b4d9a66c35c2660d2ad1f83e4ed6b39f8d8a3f453e99a01fe7aef79de1924463f260065d7694
@@ -30,9 +30,8 @@ module Hoodoo
30
30
  # end
31
31
  #
32
32
  def validate_each( record, attribute, value )
33
-
34
33
  unless value.nil? || Hoodoo::UUID.valid?( value )
35
- record.errors[ attribute ] << ( options[ :message ] || 'is invalid' )
34
+ record.errors.add(attribute, options[ :message ] || 'is invalid' )
36
35
  end
37
36
 
38
37
  end
@@ -123,10 +123,8 @@ module Hoodoo
123
123
  def self.included( model )
124
124
  model.class_attribute(
125
125
  :nz_co_loyalty_hoodoo_dated_with,
126
- {
127
- :instance_predicate => false,
128
- :instance_accessor => false
129
- }
126
+ :instance_predicate => false,
127
+ :instance_accessor => false
130
128
  )
131
129
 
132
130
  instantiate( model ) unless model == Hoodoo::ActiveRecord::Base
@@ -56,10 +56,8 @@ module Hoodoo
56
56
  :nz_co_loyalty_hoodoo_estimate_counts_with,
57
57
  :nz_co_loyalty_hoodoo_search_with,
58
58
  :nz_co_loyalty_hoodoo_filter_with,
59
- {
60
- :instance_predicate => false,
61
- :instance_accessor => false
62
- }
59
+ :instance_predicate => false,
60
+ :instance_accessor => false
63
61
  )
64
62
 
65
63
  unless model == Hoodoo::ActiveRecord::Base
@@ -386,10 +386,8 @@ module Hoodoo
386
386
  def self.included( model )
387
387
  model.class_attribute(
388
388
  :nz_co_loyalty_hoodoo_manually_dated,
389
- {
390
- :instance_predicate => false,
391
- :instance_accessor => false
392
- }
389
+ :instance_predicate => false,
390
+ :instance_accessor => false
393
391
  )
394
392
 
395
393
  unless model == Hoodoo::ActiveRecord::Base
@@ -39,10 +39,8 @@ module Hoodoo
39
39
  def self.included( model )
40
40
  model.class_attribute(
41
41
  :nz_co_loyalty_hoodoo_secure_with,
42
- {
43
- :instance_predicate => false,
44
- :instance_accessor => false
45
- }
42
+ :instance_predicate => false,
43
+ :instance_accessor => false
46
44
  )
47
45
 
48
46
  instantiate( model ) unless model == Hoodoo::ActiveRecord::Base
@@ -41,18 +41,6 @@ module Hoodoo
41
41
  #
42
42
  class SecurityHelper
43
43
 
44
- # Internally used by ::matches_wildcard for Ruby 2.4.0+ performance.
45
- #
46
- RUBY_FAST_WILDCARD_PROC_CONTENTS = %q{
47
- security_value.match?( wildcard_regexp ) rescue false
48
- }
49
-
50
- # Internally used by ::matches_wildcard for Ruby < 2.4 compatibility.
51
- #
52
- RUBY_SLOW_WILDCARD_PROC_CONTENTS = %q{
53
- wildcard_regexp.match( security_value ) != nil rescue false
54
- }
55
-
56
44
  # Match a given wildcard, typically a String, to a single value
57
45
  # via <tt>#eql?</tt>.
58
46
  #
@@ -94,21 +82,8 @@ module Hoodoo
94
82
  def self.matches_wildcard( wildcard_regexp )
95
83
  wildcard_regexp = Regexp.new( wildcard_regexp ) unless wildcard_regexp.is_a?( Regexp )
96
84
 
97
- # Use security_value's #match? (if present) to ensure that we have
98
- # an expected "matchable" type. This is only available in Ruby 2.4
99
- # or later, so a patch is performed below for earlier Rubies.
100
- #
101
85
  Proc.new do | security_value |
102
-
103
- # Ruby 2.4.0 and later introduce the Regexp#match? family, which
104
- # is the fastest way to determine a simple does-or-does-not match
105
- # condition. Ruby 2.3.x and earlier need different, slower code.
106
- #
107
- if ''.respond_to?( :match? )
108
- eval( RUBY_FAST_WILDCARD_PROC_CONTENTS )
109
- else
110
- eval( RUBY_SLOW_WILDCARD_PROC_CONTENTS )
111
- end
86
+ security_value.match?( wildcard_regexp ) rescue false
112
87
  end
113
88
  end
114
89
 
@@ -36,10 +36,8 @@ module Hoodoo
36
36
  def self.included( model )
37
37
  model.class_attribute(
38
38
  :nz_co_loyalty_hoodoo_translate_with,
39
- {
40
- :instance_predicate => false,
41
- :instance_accessor => false
42
- }
39
+ :instance_predicate => false,
40
+ :instance_accessor => false
43
41
  )
44
42
 
45
43
  instantiate( model ) unless model == Hoodoo::ActiveRecord::Base
@@ -218,7 +218,7 @@ module Hoodoo
218
218
  # Now we've a copy, we can use high level URI methods to manipulate
219
219
  # it to form the full request URI.
220
220
 
221
- remote_uri.path << "/#{ URI::escape( ident ) }" unless ident.nil?
221
+ remote_uri.path << "/#{ CGI::escape( ident ) }" unless ident.nil?
222
222
 
223
223
  # Grey area over whether this encodes spaces as "%20" or "+", but
224
224
  # so long as the middleware consistently uses the URI encode/decode
@@ -29,4 +29,3 @@ require 'hoodoo/services/middleware/middleware'
29
29
  require 'hoodoo/services/middleware/exception_reporting/exception_reporting'
30
30
  require 'hoodoo/services/middleware/exception_reporting/base_reporter'
31
31
  require 'hoodoo/services/middleware/exception_reporting/reporters/airbrake_reporter'
32
- require 'hoodoo/services/middleware/exception_reporting/reporters/raygun_reporter'
@@ -261,7 +261,7 @@ module Hoodoo
261
261
  #
262
262
  # Disabling the same extension multiple times has no side effects.
263
263
  #
264
- def self.disable( target_unit: nil, extension_module: )
264
+ def self.disable( extension_module:, target_unit: nil )
265
265
  if ( target_units_hash = @@modules[ extension_module ] ).nil?
266
266
  raise "Hoodoo::Monkey::disable: Extension module '#{ extension_module.inspect }' is not registered"
267
267
  end
@@ -17,7 +17,6 @@ module Hoodoo; module Services
17
17
  # Subclass this method to create a custom class used to contact external
18
18
  # exception monitoring / reporting engine. Examples include:
19
19
  #
20
- # * Raygun: https://raygun.io
21
20
  # * Honeybadger: https://www.honeybadger.io
22
21
  # * Exceptional: http://www.exceptional.io
23
22
  # * Airbrake: https://airbrake.io
@@ -12,11 +12,11 @@ module Hoodoo
12
12
  # The Hoodoo gem version. If this changes, be sure to re-run
13
13
  # <tt>bundle install</tt> or <tt>bundle update</tt>.
14
14
  #
15
- VERSION = '2.12.10'
15
+ VERSION = '3.1.1'
16
16
 
17
17
  # The Hoodoo gem date. If this changes, be sure to re-run
18
18
  # <tt>bundle install</tt> or <tt>bundle update</tt>.
19
19
  #
20
- DATE = '2021-09-27'
20
+ DATE = '2022-02-02'
21
21
 
22
22
  end
@@ -46,7 +46,6 @@ describe Hoodoo::ActiveRecord::Creator do
46
46
  @interaction.context.response,
47
47
  @interaction
48
48
  )
49
-
50
49
  @context = @interaction.context
51
50
  @session = @interaction.context.session
52
51
  end
@@ -65,8 +64,8 @@ describe Hoodoo::ActiveRecord::Creator do
65
64
 
66
65
  instance = klass.new_in( @context )
67
66
 
68
- expect( instance.created_at ).to eq( @time )
69
- expect( instance.updated_at ).to eq( @time )
67
+ expect( Hoodoo::Utilities.standard_datetime(instance.created_at) ).to eq( Hoodoo::Utilities.standard_datetime(@time) )
68
+ expect( Hoodoo::Utilities.standard_datetime(instance.updated_at) ).to eq( Hoodoo::Utilities.standard_datetime(@time) )
70
69
  end
71
70
 
72
71
  it 'creates with provided attributes' do
@@ -152,7 +152,7 @@ describe Hoodoo::ActiveRecord::ErrorMapping do
152
152
  } )
153
153
 
154
154
  array_col = RSpecModelErrorMappingTest.columns_hash[ 'array' ]
155
- expect( array_col ).to receive( :array ).once.and_return( true )
155
+ expect(array_col.array).to eq( true )
156
156
 
157
157
  m.adds_errors_to?( @errors )
158
158
 
@@ -79,13 +79,6 @@ describe Hoodoo::ActiveRecord::Secure::SecurityHelper do
79
79
  it 'and matches when it should' do
80
80
  expect( proc().call( '12!' ) ).to eql( true )
81
81
  expect( proc().call( '12!3' ) ).to eql( true )
82
-
83
- if ''.respond_to?( :match? )
84
- expect( proc().call( TestAllMatchersObject.new ) ).to eql( true )
85
- else
86
- expect_any_instance_of( Regexp ).to receive( :match ).and_return( true )
87
- proc().call( TestAllMatchersObject.new )
88
- end
89
82
  end
90
83
 
91
84
  it 'and misses when it should' do
@@ -95,59 +88,15 @@ describe Hoodoo::ActiveRecord::Secure::SecurityHelper do
95
88
  expect( proc().call( { :hello => :world } ) ).to eql( false )
96
89
  expect( proc().call( [ 1, 2, 3, 4 ] ) ).to eql( false )
97
90
  end
98
-
99
- it 'and rescues' do
100
- if ''.respond_to?( :match? )
101
- expect( proc().call( TestRescueAllMatchersObject.new ) ).to eql( false )
102
- else
103
- expect_any_instance_of( Regexp ).to receive( :match ).and_raise( RuntimeError )
104
- proc().call( TestRescueAllMatchersObject.new )
105
- end
106
- end
107
91
  end
108
-
109
- # Tests running on Ruby >= 2.4 need String#match? knocking out for a
110
- # while, for code coverage.
111
- #
112
- context 'with slow matcher' do
113
- before :each do
114
- @unbound_method = nil
115
-
116
- if ''.respond_to?( :match? )
117
- @unbound_method = String.instance_method( :match? )
118
- String.send( :remove_method, :match? )
119
- end
120
- end
121
-
122
- after :each do
123
- unless @unbound_method.nil?
124
- String.send( :define_method, :match?, @unbound_method )
125
- end
126
- end
127
-
128
- context 'constructed with a String' do
129
- it_behaves_like 'a ::matches_wildcard Proc'
130
- end
131
-
132
- context 'constructed with a Regexp' do
133
- let( :param ) { /^..!.*/ }
134
- it_behaves_like 'a ::matches_wildcard Proc'
135
- end
92
+
93
+ context 'constructed with a String' do
94
+ it_behaves_like 'a ::matches_wildcard Proc'
136
95
  end
137
96
 
138
- # Tests running on Ruby < 2.4 can't do the fast match tests.
139
- #
140
- if ''.respond_to?( :match? )
141
- context 'with fast matcher' do
142
- context 'constructed with a String' do
143
- it_behaves_like 'a ::matches_wildcard Proc'
144
- end
145
-
146
- context 'constructed with a Regexp' do
147
- let( :param ) { /^..!.*/ }
148
- it_behaves_like 'a ::matches_wildcard Proc'
149
- end
150
- end
97
+ context 'constructed with a Regexp' do
98
+ let( :param ) { /^..!.*/ }
99
+ it_behaves_like 'a ::matches_wildcard Proc'
151
100
  end
152
101
  end
153
102
 
@@ -461,7 +461,7 @@ describe Hoodoo::ActiveRecord::Support do
461
461
  } )
462
462
 
463
463
  array_col = RSpecModelErrorMappingTest.columns_hash[ 'array' ]
464
- expect( array_col ).to receive( :array ).once.and_return( true )
464
+ expect(array_col.array).to eq( true )
465
465
 
466
466
  m.validate()
467
467
  expect( described_class.translate_errors_on( m ).errors ).to eq( [
@@ -28,7 +28,7 @@ describe Hoodoo::ActiveRecord::UUID do
28
28
  it 'should complain about a bad UUID' do
29
29
  m = RSpecModelUUIDTest.new
30
30
  m.id = "hello"
31
-
31
+
32
32
  expect( m.save ).to eq( false )
33
33
  expect( Hoodoo::UUID.valid?( m.id ) ).to eq( false )
34
34
  expect( m.errors ).to_not be_empty
@@ -271,7 +271,7 @@ describe Hoodoo::Client do
271
271
  def set_vars_for( opts )
272
272
  @locale = rand( 2 ) == 0 ? nil : SecureRandom.urlsafe_base64(2)
273
273
  @expected_locale = @locale.nil? ? 'en-nz' : @locale.downcase
274
- @client = Hoodoo::Client.new( opts.merge( :locale => @locale ) )
274
+ @client = Hoodoo::Client.new( **opts.merge( :locale => @locale ) )
275
275
 
276
276
  endpoint_opts = {}
277
277
 
@@ -567,7 +567,7 @@ describe Hoodoo::Client do
567
567
  )
568
568
 
569
569
  expect_any_instance_of( Net::HTTP ).to receive( :open_timeout= ).with( timeout ).and_call_original
570
- expect( Timeout ).to receive( :timeout ).with( timeout, Net::OpenTimeout ).once do
570
+ allow_any_instance_of( Net::HTTP ).to receive( :connect ) do
571
571
  raise Net::OpenTimeout
572
572
  end
573
573
  end
@@ -575,7 +575,6 @@ describe Hoodoo::Client do
575
575
  it 'times out elegantly' do
576
576
  mock_ident = Hoodoo::UUID.generate()
577
577
  result = @endpoint.show( mock_ident )
578
-
579
578
  expect( result.platform_errors.has_errors? ).to eq( true )
580
579
  expect( result.platform_errors.errors[ 0 ][ 'code' ] ).to eq( 'platform.timeout' )
581
580
  end
@@ -222,11 +222,10 @@ describe Hoodoo::Client do
222
222
  end
223
223
 
224
224
  before :each do
225
-
226
- @client = Hoodoo::Client.new({
225
+ @client = Hoodoo::Client.new(
227
226
  drb_port: URI.parse( Hoodoo::Services::Discovery::ByDRb::DRbServer.uri() ).port,
228
227
  auto_session: false
229
- })
228
+ )
230
229
 
231
230
  end
232
231
 
@@ -29,7 +29,7 @@ cert.extensions = [
29
29
  cert.add_extension ef.create_extension("authorityKeyIdentifier",
30
30
  "keyid:always,issuer:always")
31
31
 
32
- cert.sign key, OpenSSL::Digest::SHA256.new
32
+ cert.sign key, OpenSSL::Digest.new('SHA256')
33
33
 
34
34
  open keyd, 'w' do |io| io.write key.to_pem end
35
35
  open certd, 'w' do |io| io.write cert.to_pem end
@@ -14,8 +14,8 @@ describe Hoodoo::Monkey::Patch::DatadogTracedAMQP, :order => :defined do
14
14
  # count them.
15
15
  #
16
16
  before :all do
17
- @@endpoint_do_amqp_count = 0
18
- @@datadog_trace_count = 0
17
+ CounterAMQ.endpoint_do_amqp_count = 0
18
+ CounterAMQ.datadog_trace_count = 0
19
19
 
20
20
  # Stub Datadog
21
21
  class Datadog
@@ -39,14 +39,14 @@ describe Hoodoo::Monkey::Patch::DatadogTracedAMQP, :order => :defined do
39
39
 
40
40
  allow_any_instance_of( Hoodoo::Client::Endpoint::AMQP ).to receive( :do_amqp ) do | instance, description_of_request |
41
41
  result = original_do_amqp.bind( instance ).call( description_of_request )
42
- @@endpoint_do_amqp_count += 1
42
+ CounterAMQ.endpoint_do_amqp_count += 1
43
43
  result
44
44
  end
45
45
 
46
46
  allow_any_instance_of( Datadog ).to receive( :trace ) do | &block |
47
47
  # Datadog Trace method responds with a yielded span this is here to mock tha
48
48
  span = double('span', trace_id: 'trace_id', span_id: 'span_id').as_null_object
49
- @@datadog_trace_count += 1
49
+ CounterAMQ.datadog_trace_count += 1
50
50
  block.call(span)
51
51
  end
52
52
  end
@@ -64,8 +64,15 @@ describe Hoodoo::Monkey::Patch::DatadogTracedAMQP, :order => :defined do
64
64
 
65
65
  context 'afterwards' do
66
66
  it 'has non-zero NewRelic method call counts' do
67
- expect( @@endpoint_do_amqp_count ).to be > 5
68
- expect( @@datadog_trace_count ).to eq( @@endpoint_do_amqp_count )
67
+ expect( CounterAMQ.endpoint_do_amqp_count ).to be > 5
68
+ expect( CounterAMQ.datadog_trace_count ).to eq( CounterAMQ.endpoint_do_amqp_count )
69
69
  end
70
70
  end
71
+ end
72
+
73
+ # Hits accumulator
74
+ class CounterAMQ
75
+ class << self
76
+ attr_accessor :endpoint_do_amqp_count, :datadog_trace_count
77
+ end
71
78
  end
@@ -14,9 +14,9 @@ describe Hoodoo::Monkey::Patch::NewRelicTracedAMQP, :order => :defined do
14
14
  # count them.
15
15
  #
16
16
  before :all do
17
- @@endpoint_do_amqp_count = 0
18
- @@newrelic_crossapp_count = 0
19
- @@newrelic_agent_disable_count = 0
17
+ CounterAMQ.endpoint_do_amqp_count = 0
18
+ CounterAMQ.newrelic_crossapp_count = 0
19
+ CounterAMQ.newrelic_agent_disable_count = 0
20
20
 
21
21
  Hoodoo::Monkey.enable( extension_module: Hoodoo::Monkey::Patch::NewRelicTracedAMQP )
22
22
 
@@ -44,14 +44,14 @@ describe Hoodoo::Monkey::Patch::NewRelicTracedAMQP, :order => :defined do
44
44
  #
45
45
  allow_any_instance_of( Hoodoo::Client::Endpoint::AMQP ).to receive( :do_amqp ) do | instance, description_of_request |
46
46
  result = original_do_amqp.bind( instance ).call( description_of_request )
47
- @@endpoint_do_amqp_count += 1
47
+ CounterAMQ.endpoint_do_amqp_count += 1
48
48
  result
49
49
  end
50
50
 
51
51
  # We should always start a new Segment...
52
52
  #
53
53
  allow( ::NewRelic::Agent::Transaction ).to receive( :start_external_request_segment ) do | type, uri, method |
54
- @@newrelic_crossapp_count += 1
54
+ CounterAMQ.newrelic_crossapp_count += 1
55
55
 
56
56
  expect( type ).to eq( 'AlchemyFlux' )
57
57
  expect( uri ).to be_a( URI )
@@ -64,7 +64,7 @@ describe Hoodoo::Monkey::Patch::NewRelicTracedAMQP, :order => :defined do
64
64
  # that segment.
65
65
  #
66
66
  allow_any_instance_of( ::NewRelic::Agent::Transaction::Segment ).to receive( :finish ) do
67
- @@newrelic_agent_disable_count += 1
67
+ CounterAMQ.newrelic_agent_disable_count += 1
68
68
  end
69
69
  end
70
70
 
@@ -72,9 +72,9 @@ describe Hoodoo::Monkey::Patch::NewRelicTracedAMQP, :order => :defined do
72
72
 
73
73
  context 'afterwards' do
74
74
  it 'has non-zero NewRelic method call counts' do
75
- expect( @@endpoint_do_amqp_count ).to be > 5
76
- expect( @@newrelic_crossapp_count ).to eq( @@endpoint_do_amqp_count )
77
- expect( @@newrelic_agent_disable_count ).to eq( @@endpoint_do_amqp_count )
75
+ expect( CounterAMQ.endpoint_do_amqp_count ).to be > 5
76
+ expect( CounterAMQ.newrelic_crossapp_count ).to eq( CounterAMQ.endpoint_do_amqp_count )
77
+ expect( CounterAMQ.newrelic_agent_disable_count ).to eq( CounterAMQ.endpoint_do_amqp_count )
78
78
  end
79
79
  end
80
80
  end
@@ -191,3 +191,10 @@ describe Hoodoo::Monkey::Patch::NewRelicTracedAMQP::AlchemyFluxHTTPResponseWrapp
191
191
  expect( @wrapper.to_hash ).to eq( @http_response[ 'headers' ] )
192
192
  end
193
193
  end
194
+
195
+ # Hits accumulator
196
+ class CounterAMQ
197
+ class << self
198
+ attr_accessor :endpoint_do_amqp_count, :newrelic_crossapp_count, :newrelic_agent_disable_count
199
+ end
200
+ end
data/spec/spec_helper.rb CHANGED
@@ -199,6 +199,8 @@ def spec_helper_connect_to_postgres( database_name = 'postgres' )
199
199
  ActiveRecord::Base.establish_connection(
200
200
  :adapter => 'postgresql',
201
201
  :username => ENV[ 'DATABASE_USER' ],
202
+ :host => '127.0.0.1',
203
+ :port => ENV[ 'DATABASE_PORT' ] || 5432,
202
204
  :database => database_name
203
205
  )
204
206
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoodoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.10
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loyalty New Zealand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dalli
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 5.2.4.3
47
+ version: 7.0.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 5.2.4.3
54
+ version: 7.0.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 5.2.4.3
61
+ version: 7.0.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 5.2.4.3
68
+ version: 7.0.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: airbrake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '1.7'
145
+ version: '1.8'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '1.7'
152
+ version: '1.8'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: le
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -207,75 +207,75 @@ dependencies:
207
207
  - !ruby/object:Gem::Version
208
208
  version: '12.0'
209
209
  - !ruby/object:Gem::Dependency
210
- name: raygun4ruby
210
+ name: redis
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: '2.7'
215
+ version: '4.0'
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: '2.7'
222
+ version: '4.0'
223
223
  - !ruby/object:Gem::Dependency
224
- name: redis
224
+ name: rspec
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: '4.0'
229
+ version: '3.11'
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
- version: '4.0'
236
+ version: '3.11'
237
237
  - !ruby/object:Gem::Dependency
238
- name: rspec
238
+ name: rspec-mocks
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: '3.8'
243
+ version: '3.11'
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: '3.8'
250
+ version: '3.11'
251
251
  - !ruby/object:Gem::Dependency
252
- name: rspec-mocks
252
+ name: simplecov-rcov
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - "~>"
256
256
  - !ruby/object:Gem::Version
257
- version: '3.8'
257
+ version: '0.2'
258
258
  type: :development
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - "~>"
263
263
  - !ruby/object:Gem::Version
264
- version: '3.8'
264
+ version: '0.2'
265
265
  - !ruby/object:Gem::Dependency
266
- name: simplecov-rcov
266
+ name: webrick
267
267
  requirement: !ruby/object:Gem::Requirement
268
268
  requirements:
269
- - - "~>"
269
+ - - ">="
270
270
  - !ruby/object:Gem::Version
271
- version: '0.2'
271
+ version: '0'
272
272
  type: :development
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
- - - "~>"
276
+ - - ">="
277
277
  - !ruby/object:Gem::Version
278
- version: '0.2'
278
+ version: '0'
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: timecop
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -416,7 +416,6 @@ files:
416
416
  - lib/hoodoo/services/middleware/exception_reporting/base_reporter.rb
417
417
  - lib/hoodoo/services/middleware/exception_reporting/exception_reporting.rb
418
418
  - lib/hoodoo/services/middleware/exception_reporting/reporters/airbrake_reporter.rb
419
- - lib/hoodoo/services/middleware/exception_reporting/reporters/raygun_reporter.rb
420
419
  - lib/hoodoo/services/middleware/interaction.rb
421
420
  - lib/hoodoo/services/middleware/middleware.rb
422
421
  - lib/hoodoo/services/middleware/rack_monkey_patch.rb
@@ -533,7 +532,6 @@ files:
533
532
  - spec/services/middleware/exception_reporting/base_reporter_spec.rb
534
533
  - spec/services/middleware/exception_reporting/exception_reporting_spec.rb
535
534
  - spec/services/middleware/exception_reporting/reporters/airbrake_reporter_spec.rb
536
- - spec/services/middleware/exception_reporting/reporters/raygun_reporter_spec.rb
537
535
  - spec/services/middleware/middleware_assumed_identity_spec.rb
538
536
  - spec/services/middleware/middleware_cors_spec.rb
539
537
  - spec/services/middleware/middleware_create_update_spec.rb
@@ -577,139 +575,138 @@ required_ruby_version: !ruby/object:Gem::Requirement
577
575
  requirements:
578
576
  - - ">="
579
577
  - !ruby/object:Gem::Version
580
- version: 2.3.5
578
+ version: 3.1.0
581
579
  required_rubygems_version: !ruby/object:Gem::Requirement
582
580
  requirements:
583
581
  - - ">="
584
582
  - !ruby/object:Gem::Version
585
583
  version: '0'
586
584
  requirements: []
587
- rubygems_version: 3.2.28
585
+ rubygems_version: 3.1.2
588
586
  signing_key:
589
587
  specification_version: 4
590
588
  summary: Opinionated APIs
591
589
  test_files:
592
590
  - spec/shared_examples/middleware_amqp.rb
591
+ - spec/logger/writers/file_writer_spec.rb
592
+ - spec/logger/writers/stream_writer_spec.rb
593
+ - spec/logger/writers/log_entries_dot_com_writer_spec.rb
594
+ - spec/logger/slow_writer_spec.rb
595
+ - spec/logger/logger_spec.rb
596
+ - spec/logger/fast_writer_spec.rb
597
+ - spec/integration/service_actions_spec.rb
598
+ - spec/new_relic/agent/transaction.rb
599
+ - spec/new_relic/agent/method_tracer.rb
600
+ - spec/new_relic/agent/logger.rb
601
+ - spec/utilities/utilities_spec.rb
602
+ - spec/utilities/uuid_spec.rb
593
603
  - spec/newrelic_rpm.rb
594
- - spec/errors/error_descriptions_spec.rb
595
604
  - spec/errors/errors_spec.rb
596
- - spec/ddtrace.rb
597
- - spec/services/services/interface_spec.rb
598
- - spec/services/services/application_spec.rb
599
- - spec/services/services/session_spec.rb
605
+ - spec/errors/error_descriptions_spec.rb
606
+ - spec/active/active_record/dated_spec.rb
607
+ - spec/active/active_record/error_mapping_spec.rb
608
+ - spec/active/active_record/translated_spec.rb
609
+ - spec/active/active_record/security_helper_spec.rb
610
+ - spec/active/active_record/uuid_spec.rb
611
+ - spec/active/active_record/base_spec.rb
612
+ - spec/active/active_record/manually_dated_spec.rb
613
+ - spec/active/active_record/writer_spec.rb
614
+ - spec/active/active_record/creator_spec.rb
615
+ - spec/active/active_record/finder_spec.rb
616
+ - spec/active/active_record/search_helper_spec.rb
617
+ - spec/active/active_record/error_mapping_shared_context.rb
618
+ - spec/active/active_record/support_spec.rb
619
+ - spec/active/active_record/secure_spec.rb
620
+ - spec/data/resources/errors_spec.rb
621
+ - spec/data/resources/caller_spec.rb
622
+ - spec/data/resources/log_spec.rb
623
+ - spec/data/resources/session_spec.rb
624
+ - spec/data/types/error_primitive_spec.rb
625
+ - spec/data/types/permissions_resources_spec.rb
626
+ - spec/data/types/permissions_spec.rb
627
+ - spec/data/types/permissions_defaults_spec.rb
628
+ - spec/data/types/permissions_full_spec.rb
629
+ - spec/communicators/pool_spec.rb
630
+ - spec/communicators/fast_spec.rb
631
+ - spec/communicators/slow_spec.rb
632
+ - spec/monkey/monkey_spec.rb
633
+ - spec/monkey/patch/newrelic_traced_amqp_spec.rb
634
+ - spec/monkey/patch/newrelic_middleware_analytics_spec.rb
635
+ - spec/monkey/patch/datadog_traced_amqp_spec.rb
600
636
  - spec/services/services/response_spec.rb
601
- - spec/services/services/permissions_spec.rb
602
637
  - spec/services/services/request_spec.rb
638
+ - spec/services/services/permissions_spec.rb
603
639
  - spec/services/services/implementation_spec.rb
604
640
  - spec/services/services/context_spec.rb
605
- - spec/services/discovery/discovery_spec.rb
606
- - spec/services/discovery/results/for_remote_spec.rb
607
- - spec/services/discovery/results/for_http_spec.rb
608
- - spec/services/discovery/results/for_amqp_spec.rb
609
- - spec/services/discovery/results/for_local_spec.rb
610
- - spec/services/discovery/discoverers/by_convention_spec.rb
611
- - spec/services/discovery/discoverers/by_flux_spec.rb
612
- - spec/services/discovery/discoverers/by_drb/by_drb_spec.rb
613
- - spec/services/discovery/discoverers/by_drb/drb_server_spec.rb
614
- - spec/services/middleware/endpoints/inter_resource_remote_spec.rb
615
- - spec/services/middleware/endpoints/inter_resource_local_spec.rb
616
- - spec/services/middleware/middleware_assumed_identity_spec.rb
617
- - spec/services/middleware/middleware_create_update_spec.rb
618
- - spec/services/middleware/middleware_spec.rb
619
- - spec/services/middleware/middleware_exotic_communication_spec.rb
641
+ - spec/services/services/application_spec.rb
642
+ - spec/services/services/session_spec.rb
643
+ - spec/services/services/interface_spec.rb
620
644
  - spec/services/middleware/string_inquirer_spec.rb
621
- - spec/services/middleware/middleware_public_spec.rb
645
+ - spec/services/middleware/amqp_log_writer_spec.rb
622
646
  - spec/services/middleware/middleware_logging_spec.rb
623
647
  - spec/services/middleware/middleware_dated_at_spec.rb
624
648
  - spec/services/middleware/middleware_multi_local_spec.rb
625
- - spec/services/middleware/amqp_log_writer_spec.rb
626
- - spec/services/middleware/middleware_cors_spec.rb
649
+ - spec/services/middleware/middleware_exotic_communication_spec.rb
650
+ - spec/services/middleware/middleware_spec.rb
627
651
  - spec/services/middleware/middleware_permissions_spec.rb
628
- - spec/services/middleware/exception_reporting/exception_reporting_spec.rb
652
+ - spec/services/middleware/middleware_assumed_identity_spec.rb
653
+ - spec/services/middleware/endpoints/inter_resource_remote_spec.rb
654
+ - spec/services/middleware/endpoints/inter_resource_local_spec.rb
629
655
  - spec/services/middleware/exception_reporting/reporters/airbrake_reporter_spec.rb
630
- - spec/services/middleware/exception_reporting/reporters/raygun_reporter_spec.rb
631
656
  - spec/services/middleware/exception_reporting/base_reporter_spec.rb
657
+ - spec/services/middleware/exception_reporting/exception_reporting_spec.rb
658
+ - spec/services/middleware/middleware_create_update_spec.rb
659
+ - spec/services/middleware/middleware_cors_spec.rb
632
660
  - spec/services/middleware/middleware_multi_remote_spec.rb
633
- - spec/files/regenerate.rb
634
- - spec/integration/service_actions_spec.rb
635
- - spec/new_relic/agent/transaction.rb
636
- - spec/new_relic/agent/method_tracer.rb
637
- - spec/new_relic/agent/logger.rb
638
- - spec/communicators/pool_spec.rb
639
- - spec/communicators/slow_spec.rb
640
- - spec/communicators/fast_spec.rb
641
- - spec/transient_store/transient_store/mocks/dalli_client_spec.rb
642
- - spec/transient_store/transient_store/mocks/redis_spec.rb
643
- - spec/transient_store/transient_store/memcached_redis_mirror_spec.rb
661
+ - spec/services/middleware/middleware_public_spec.rb
662
+ - spec/services/discovery/discoverers/by_convention_spec.rb
663
+ - spec/services/discovery/discoverers/by_flux_spec.rb
664
+ - spec/services/discovery/discoverers/by_drb/drb_server_spec.rb
665
+ - spec/services/discovery/discoverers/by_drb/by_drb_spec.rb
666
+ - spec/services/discovery/results/for_local_spec.rb
667
+ - spec/services/discovery/results/for_http_spec.rb
668
+ - spec/services/discovery/results/for_remote_spec.rb
669
+ - spec/services/discovery/results/for_amqp_spec.rb
670
+ - spec/services/discovery/discovery_spec.rb
671
+ - spec/client/augmented_array_spec.rb
672
+ - spec/client/client_spec.rb
673
+ - spec/client/paginated_enumeration_spec.rb
674
+ - spec/client/headers_spec.rb
675
+ - spec/client/endpoint/endpoint_spec.rb
676
+ - spec/client/endpoint/endpoints/http_based_spec.rb
677
+ - spec/client/endpoint/endpoints/auto_session_spec.rb
678
+ - spec/client/endpoint/endpoints/amqp_spec.rb
679
+ - spec/client/endpoint/endpoints/not_found_spec.rb
680
+ - spec/client/endpoint/endpoints/http_spec.rb
681
+ - spec/client/augmented_base_spec.rb
682
+ - spec/client/augmented_hash_spec.rb
683
+ - spec/transient_store/transient_store/memcached_spec.rb
644
684
  - spec/transient_store/transient_store/base_spec.rb
645
685
  - spec/transient_store/transient_store/redis_spec.rb
646
- - spec/transient_store/transient_store/memcached_spec.rb
686
+ - spec/transient_store/transient_store/memcached_redis_mirror_spec.rb
687
+ - spec/transient_store/transient_store/mocks/redis_spec.rb
688
+ - spec/transient_store/transient_store/mocks/dalli_client_spec.rb
647
689
  - spec/transient_store/transient_store_spec.rb
648
- - spec/spec_helper.rb
649
- - spec/utilities/uuid_spec.rb
650
- - spec/utilities/utilities_spec.rb
651
- - spec/presenters/common_resource_fields_spec.rb
652
690
  - spec/presenters/embedding_spec.rb
653
691
  - spec/presenters/base_spec.rb
654
692
  - spec/presenters/walk_spec.rb
655
- - spec/presenters/types/float_spec.rb
693
+ - spec/presenters/common_resource_fields_spec.rb
694
+ - spec/presenters/base_dsl_spec.rb
695
+ - spec/presenters/types/field_spec.rb
656
696
  - spec/presenters/types/text_spec.rb
657
697
  - spec/presenters/types/date_spec.rb
698
+ - spec/presenters/types/date_time_spec.rb
699
+ - spec/presenters/types/boolean_spec.rb
658
700
  - spec/presenters/types/uuid_spec.rb
659
- - spec/presenters/types/object_spec.rb
701
+ - spec/presenters/types/float_spec.rb
702
+ - spec/presenters/types/string_spec.rb
660
703
  - spec/presenters/types/hash_spec.rb
661
- - spec/presenters/types/field_spec.rb
662
704
  - spec/presenters/types/array_spec.rb
663
705
  - spec/presenters/types/decimal_spec.rb
664
- - spec/presenters/types/string_spec.rb
665
- - spec/presenters/types/enum_spec.rb
666
- - spec/presenters/types/boolean_spec.rb
667
- - spec/presenters/types/date_time_spec.rb
668
706
  - spec/presenters/types/integer_spec.rb
707
+ - spec/presenters/types/object_spec.rb
669
708
  - spec/presenters/types/tags_spec.rb
670
- - spec/presenters/base_dsl_spec.rb
671
- - spec/monkey/patch/newrelic_traced_amqp_spec.rb
672
- - spec/monkey/patch/datadog_traced_amqp_spec.rb
673
- - spec/monkey/patch/newrelic_middleware_analytics_spec.rb
674
- - spec/monkey/monkey_spec.rb
675
- - spec/logger/slow_writer_spec.rb
676
- - spec/logger/logger_spec.rb
677
- - spec/logger/fast_writer_spec.rb
678
- - spec/logger/writers/stream_writer_spec.rb
679
- - spec/logger/writers/file_writer_spec.rb
680
- - spec/logger/writers/log_entries_dot_com_writer_spec.rb
681
- - spec/client/augmented_array_spec.rb
682
- - spec/client/paginated_enumeration_spec.rb
683
- - spec/client/endpoint/endpoints/http_spec.rb
684
- - spec/client/endpoint/endpoints/http_based_spec.rb
685
- - spec/client/endpoint/endpoints/amqp_spec.rb
686
- - spec/client/endpoint/endpoints/not_found_spec.rb
687
- - spec/client/endpoint/endpoints/auto_session_spec.rb
688
- - spec/client/endpoint/endpoint_spec.rb
689
- - spec/client/headers_spec.rb
690
- - spec/client/augmented_hash_spec.rb
691
- - spec/client/augmented_base_spec.rb
692
- - spec/client/client_spec.rb
693
- - spec/active/active_record/translated_spec.rb
694
- - spec/active/active_record/secure_spec.rb
695
- - spec/active/active_record/support_spec.rb
696
- - spec/active/active_record/search_helper_spec.rb
697
- - spec/active/active_record/uuid_spec.rb
698
- - spec/active/active_record/security_helper_spec.rb
699
- - spec/active/active_record/dated_spec.rb
700
- - spec/active/active_record/base_spec.rb
701
- - spec/active/active_record/manually_dated_spec.rb
702
- - spec/active/active_record/error_mapping_shared_context.rb
703
- - spec/active/active_record/writer_spec.rb
704
- - spec/active/active_record/error_mapping_spec.rb
705
- - spec/active/active_record/finder_spec.rb
706
- - spec/active/active_record/creator_spec.rb
707
- - spec/data/resources/log_spec.rb
708
- - spec/data/resources/errors_spec.rb
709
- - spec/data/resources/session_spec.rb
710
- - spec/data/resources/caller_spec.rb
711
- - spec/data/types/error_primitive_spec.rb
712
- - spec/data/types/permissions_defaults_spec.rb
713
- - spec/data/types/permissions_resources_spec.rb
714
- - spec/data/types/permissions_full_spec.rb
715
- - spec/data/types/permissions_spec.rb
709
+ - spec/presenters/types/enum_spec.rb
710
+ - spec/spec_helper.rb
711
+ - spec/files/regenerate.rb
712
+ - spec/ddtrace.rb
@@ -1,79 +0,0 @@
1
- ########################################################################
2
- # File:: raygun_reporter.rb
3
- # (C):: Loyalty New Zealand 2014
4
- #
5
- # Purpose:: Send exception details to Raygun.
6
- # ----------------------------------------------------------------------
7
- # 08-Dec-2014 (ADH): Created.
8
- ########################################################################
9
-
10
- module Hoodoo; module Services
11
- class Middleware
12
-
13
- class ExceptionReporting
14
-
15
- # Hoodoo::Services::Middleware::ExceptionReporting::BaseReporter subclass
16
- # giving Hoodoo::Services::Middleware::ExceptionReporting access to
17
- # Raygun for error reporting. See https://raygun.io.
18
- #
19
- # Your application must include the Raygun gem 'raygun4ruby' via Gemfile
20
- # (+gem 'raygun4ruby'+ / +bundle install) or direct installation (+gem
21
- # install raygun4ruby+).
22
- #
23
- # The API key must be set during your application initialization and the
24
- # class must be added to Hoodoo for use as an error reporter, e.g.
25
- # through a 'config/initializers' folder, as follows:
26
- #
27
- # require 'raygun4ruby'
28
- #
29
- # Raygun.setup do | config |
30
- # config.api_key = 'YOUR_RAYGUN_API_KEY'
31
- # end
32
- #
33
- # Hoodoo::Services::Middleware::ExceptionReporting.add(
34
- # Hoodoo::Services::Middleware::ExceptionReporting::RaygunReporter
35
- # ) unless Service.config.env.test? || Service.config.env.development?
36
- #
37
- # Services and the Hoodoo middleware do not pass Rails-like params
38
- # around in forms or query strings, but do beware of search or filter
39
- # query data containing sensitive material or POST bodies in e.g. JSON
40
- # encoding containing sensitive data. This comes down to the filtering
41
- # ability of the Raygun gem:
42
- #
43
- # https://github.com/MindscapeHQ/raygun4ruby
44
- #
45
- class RaygunReporter < Hoodoo::Services::Middleware::ExceptionReporting::BaseReporter
46
-
47
- # Report an exception to Raygun.
48
- #
49
- # +e+:: Exception (or subclass) instance to be reported.
50
- #
51
- # +env+:: Optional Rack environment hash for the inbound request,
52
- # for exception reports made in the context of Rack request
53
- # handling.
54
- #
55
- def report( e, env = nil )
56
- Raygun.track_exception( e, env )
57
- end
58
-
59
- # Report an exception for errors that occur within a fully handled Rack
60
- # request context, with a high level processed Hoodoo representation
61
- # available.
62
- #
63
- # +e+:: Exception (or subclass) instance to be reported.
64
- #
65
- # +context+:: Hoodoo::Services::Context instance describing an
66
- # in-flight request/response cycle.
67
- #
68
- def contextual_report( e, context )
69
- hash = context.owning_interaction.rack_request.env rescue {}
70
- hash = hash.merge( :custom_data => user_data_for( context ) || { 'user_data' => 'unknown' } )
71
-
72
- Raygun.track_exception( e, hash )
73
- end
74
- end
75
-
76
- end
77
-
78
- end
79
- end; end
@@ -1,89 +0,0 @@
1
- require 'spec_helper'
2
- require 'raygun4ruby'
3
-
4
- # This doesn't test the Raygun gem / configuration itself - just check that
5
- # the appropriate Raygun method gets called.
6
-
7
- describe Hoodoo::Services::Middleware::ExceptionReporting::RaygunReporter do
8
-
9
- before :each do
10
- Hoodoo::Services::Middleware::ExceptionReporting.add( described_class )
11
- end
12
-
13
- after :each do
14
- Hoodoo::Services::Middleware::ExceptionReporting.wait()
15
- Hoodoo::Services::Middleware::ExceptionReporting.remove( described_class )
16
- end
17
-
18
- context '#report' do
19
- it 'calls Raygun correctly without an "env"' do
20
- ex = RuntimeError.new( 'A' )
21
-
22
- expect( Raygun ).to receive( :track_exception ).once do | e, opts |
23
- expect( e ).to be_a( Exception )
24
- expect( opts ).to be_nil
25
- end
26
-
27
- Hoodoo::Services::Middleware::ExceptionReporting.report( ex )
28
- end
29
-
30
- it 'calls Raygun correctly with an "env"' do
31
- ex = RuntimeError.new( 'A' )
32
- mock_env = { 'rack' => 'request' }
33
-
34
- expect( Raygun ).to receive( :track_exception ).once do | e, opts |
35
- expect( e ).to be_a( Exception )
36
-
37
- expect( opts ).to be_a( Hash )
38
- expect( opts ).to eq( mock_env )
39
- end
40
-
41
- Hoodoo::Services::Middleware::ExceptionReporting.report( ex, mock_env )
42
- end
43
- end
44
-
45
- context '#contextual_report' do
46
- it 'calls Raygun correctly' do
47
- ex = RuntimeError.new( 'A' )
48
- co = OpenStruct.new
49
- mock_user_data = { :foo => :bar }
50
- mock_env = { 'rack' => 'request' }
51
-
52
- co.owning_interaction = OpenStruct.new
53
- co.owning_interaction.rack_request = OpenStruct.new
54
- co.owning_interaction.rack_request.env = mock_env
55
-
56
- expect( described_class.instance ).to receive( :user_data_for ).once.and_return( mock_user_data )
57
-
58
- expect( Raygun ).to receive( :track_exception ).once do | e, opts |
59
- expect( e ).to be_a( Exception )
60
-
61
- expect( opts ).to be_a( Hash )
62
- expect( opts ).to eq( mock_env.merge( :custom_data => mock_user_data ) )
63
- end
64
-
65
- Hoodoo::Services::Middleware::ExceptionReporting.contextual_report( ex, co )
66
- end
67
-
68
- it 'has special case handling for user data recovery failure' do
69
- ex = RuntimeError.new( 'A' )
70
- co = OpenStruct.new
71
- mock_env = { 'rack' => 'request' }
72
-
73
- co.owning_interaction = OpenStruct.new
74
- co.owning_interaction.rack_request = OpenStruct.new
75
- co.owning_interaction.rack_request.env = mock_env
76
-
77
- expect( described_class.instance ).to receive( :user_data_for ).once.and_return( nil )
78
-
79
- expect( Raygun ).to receive( :track_exception ).once do | e, opts |
80
- expect( e ).to be_a( Exception )
81
-
82
- expect( opts ).to be_a( Hash )
83
- expect( opts ).to eq( mock_env.merge( :custom_data => { 'user_data' => 'unknown' } ) )
84
- end
85
-
86
- Hoodoo::Services::Middleware::ExceptionReporting.contextual_report( ex, co )
87
- end
88
- end
89
- end