Sha256: 6edf271d11deabc559e98538413231231ebd9126d459f3100ea8ed49370ddd87

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

module Authograph
  module RSpecHelpers
    def stub_authograph(_matcher, _signature = nil)
      if _signature.nil?
        _signature = _matcher
        _matcher = :any
      end

      allow_any_instance_of(Authograph::Signer)
        .to receive(:calc_signature)
        .and_wrap_original do |original, request, secret|
          case _matcher
          when :any
            next _signature
          when Hash
            # TODO
          end

          original.call(request, secret) # fallback to original
        end
    end
  end
end

RSpec.configure do |config|
  config.include Authograph::RSpecHelpers
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authograph-1.0.5 lib/authograph/rspec.rb
authograph-1.0.4 lib/authograph/rspec.rb
authograph-1.0.3 lib/authograph/rspec.rb
authograph-1.0.2 lib/authograph/rspec.rb