hoodoo 3.0.1 → 3.1.3
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 +4 -4
- data/lib/hoodoo/active/active_record/dated.rb +2 -4
- data/lib/hoodoo/active/active_record/finder.rb +2 -4
- data/lib/hoodoo/active/active_record/manually_dated.rb +2 -4
- data/lib/hoodoo/active/active_record/secure.rb +2 -4
- data/lib/hoodoo/active/active_record/security_helper.rb +1 -26
- data/lib/hoodoo/active/active_record/translated.rb +2 -4
- data/lib/hoodoo/client/endpoint/endpoints/http_based.rb +1 -1
- data/lib/hoodoo/middleware.rb +0 -1
- data/lib/hoodoo/monkey/monkey.rb +1 -1
- data/lib/hoodoo/services/middleware/exception_reporting/base_reporter.rb +0 -1
- data/lib/hoodoo/version.rb +2 -2
- data/spec/active/active_record/security_helper_spec.rb +6 -57
- data/spec/client/client_spec.rb +2 -3
- data/spec/client/paginated_enumeration_spec.rb +2 -3
- data/spec/files/regenerate.rb +1 -1
- data/spec/monkey/patch/datadog_traced_amqp_spec.rb +13 -6
- data/spec/monkey/patch/newrelic_traced_amqp_spec.rb +16 -9
- data/spec/spec_helper.rb +2 -1
- metadata +115 -118
- data/lib/hoodoo/services/middleware/exception_reporting/reporters/raygun_reporter.rb +0 -79
- data/spec/services/middleware/exception_reporting/reporters/raygun_reporter_spec.rb +0 -89
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9239562d6116c04e77c8a5274f62b94888f4f65902cd25df12e6dd119d0697a6
         | 
| 4 | 
            +
              data.tar.gz: 939cb088c84a8911696dbe8eaef2e4a66a119a2ef000dc7b110300ca702bf75e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 19d89e1b42a4288d175f20a157804f396e314449b530f60c447f68670836adcdde2e43be89017aac867381cd163d812d53962db8a08ee0ecce06f5a846da8bf8
         | 
| 7 | 
            +
              data.tar.gz: 360d3355684d9f119f59db218762a7a77be42bb1720bcf773efa09ef8791d791a35cd37eca4d4c70379450da206519a666c4b3dea32c0d01d94d67760c9723d0
         | 
| @@ -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 | 
            -
             | 
| 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 | 
            -
             | 
| 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 | 
            -
             | 
| 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 | 
            -
             | 
| 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 | 
            -
             | 
| 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 << "/#{  | 
| 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
         | 
    
        data/lib/hoodoo/middleware.rb
    CHANGED
    
    | @@ -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'
         | 
    
        data/lib/hoodoo/monkey/monkey.rb
    CHANGED
    
    | @@ -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 | 
| 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
         | 
    
        data/lib/hoodoo/version.rb
    CHANGED
    
    | @@ -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 = '3. | 
| 15 | 
            +
              VERSION = '3.1.3'
         | 
| 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 = '2022- | 
| 20 | 
            +
              DATE = '2022-08-02'
         | 
| 21 21 |  | 
| 22 22 | 
             
            end
         | 
| @@ -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 | 
            -
                 | 
| 110 | 
            -
             | 
| 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 | 
            -
                 | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 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 |  | 
    
        data/spec/client/client_spec.rb
    CHANGED
    
    | @@ -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 | 
            -
                     | 
| 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 |  | 
    
        data/spec/files/regenerate.rb
    CHANGED
    
    | @@ -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 | 
| 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 | 
            -
                 | 
| 18 | 
            -
                 | 
| 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 | 
            -
                   | 
| 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 | 
            -
                   | 
| 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(  | 
| 68 | 
            -
                  expect(  | 
| 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 | 
            -
                 | 
| 18 | 
            -
                 | 
| 19 | 
            -
                 | 
| 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 | 
            -
                   | 
| 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 | 
            -
                   | 
| 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 | 
            -
                   | 
| 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(  | 
| 76 | 
            -
                  expect(  | 
| 77 | 
            -
                  expect(  | 
| 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
    
    | @@ -198,7 +198,8 @@ Dir[ "#{ File.dirname( __FILE__ ) }/shared_examples/**/*.rb" ].sort.each { | f | | |
| 198 198 | 
             
            def spec_helper_connect_to_postgres( database_name = 'postgres' )
         | 
| 199 199 | 
             
              ActiveRecord::Base.establish_connection(
         | 
| 200 200 | 
             
                :adapter  => 'postgresql',
         | 
| 201 | 
            -
                :username => ENV[ 'DATABASE_USER' ],
         | 
| 201 | 
            +
                :username => ENV[ 'DATABASE_USER' ] || 'postgres',
         | 
| 202 | 
            +
                :password => 'password',
         | 
| 202 203 | 
             
                :host     => '127.0.0.1',
         | 
| 203 204 | 
             
                :port     => ENV[ 'DATABASE_PORT' ] || 5432,
         | 
| 204 205 | 
             
                :database => database_name
         | 
    
        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: 3. | 
| 4 | 
            +
              version: 3.1.3
         | 
| 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: 2022- | 
| 11 | 
            +
            date: 2022-08-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: dalli
         | 
| @@ -207,75 +207,75 @@ dependencies: | |
| 207 207 | 
             
                  - !ruby/object:Gem::Version
         | 
| 208 208 | 
             
                    version: '12.0'
         | 
| 209 209 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 210 | 
            -
              name:  | 
| 210 | 
            +
              name: redis
         | 
| 211 211 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 212 212 | 
             
                requirements:
         | 
| 213 213 | 
             
                - - "~>"
         | 
| 214 214 | 
             
                  - !ruby/object:Gem::Version
         | 
| 215 | 
            -
                    version: ' | 
| 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: ' | 
| 222 | 
            +
                    version: '4.0'
         | 
| 223 223 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 224 | 
            -
              name:  | 
| 224 | 
            +
              name: rspec
         | 
| 225 225 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 226 226 | 
             
                requirements:
         | 
| 227 227 | 
             
                - - "~>"
         | 
| 228 228 | 
             
                  - !ruby/object:Gem::Version
         | 
| 229 | 
            -
                    version: ' | 
| 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: ' | 
| 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. | 
| 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. | 
| 250 | 
            +
                    version: '3.11'
         | 
| 251 251 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 252 | 
            -
              name:  | 
| 252 | 
            +
              name: simplecov-rcov
         | 
| 253 253 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 254 254 | 
             
                requirements:
         | 
| 255 255 | 
             
                - - "~>"
         | 
| 256 256 | 
             
                  - !ruby/object:Gem::Version
         | 
| 257 | 
            -
                    version: ' | 
| 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: ' | 
| 264 | 
            +
                    version: '0.2'
         | 
| 265 265 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 266 | 
            -
              name:  | 
| 266 | 
            +
              name: webrick
         | 
| 267 267 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 268 268 | 
             
                requirements:
         | 
| 269 | 
            -
                - - " | 
| 269 | 
            +
                - - ">="
         | 
| 270 270 | 
             
                  - !ruby/object:Gem::Version
         | 
| 271 | 
            -
                    version: '0 | 
| 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 | 
| 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:  | 
| 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. | 
| 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/ | 
| 597 | 
            -
            - spec/ | 
| 598 | 
            -
            - spec/ | 
| 599 | 
            -
            - spec/ | 
| 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/ | 
| 606 | 
            -
            - spec/services/ | 
| 607 | 
            -
            - spec/services/ | 
| 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/ | 
| 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/ | 
| 626 | 
            -
            - spec/services/middleware/ | 
| 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/ | 
| 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/ | 
| 634 | 
            -
            - spec/ | 
| 635 | 
            -
            - spec/ | 
| 636 | 
            -
            - spec/ | 
| 637 | 
            -
            - spec/ | 
| 638 | 
            -
            - spec/ | 
| 639 | 
            -
            - spec/ | 
| 640 | 
            -
            - spec/ | 
| 641 | 
            -
            - spec/ | 
| 642 | 
            -
            - spec/ | 
| 643 | 
            -
            - spec/ | 
| 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/ | 
| 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/ | 
| 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/ | 
| 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/ | 
| 671 | 
            -
            - spec/ | 
| 672 | 
            -
            - spec/ | 
| 673 | 
            -
            - spec/ | 
| 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
         |