module Authograph::RSpecHelpers

Public Instance Methods

stub_authograph(_matcher, _signature = nil) click to toggle source
# File lib/authograph/rspec.rb, line 3
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