module OAuthenticator::RackTestSigner

Public Instance Methods

signing_rack_test(oauth_attrs) { || ... } click to toggle source

takes a block. for the duration of the block, requests made with Rack::Test will be signed with the given oauth_attrs. oauth_attrs are passed to {OAuthenticator::SignableRequest}.

attributes of the request are set from the Rack::Test request, so you should not provide those in the outh_attrs.

These are the options you should or may provide (see {OAuthenticator::SignableRequest} for details of what options are required, what options have default or generated values, and what may be omitted):

  • signature_method

  • consumer_key

  • consumer_secret

  • token

  • token_secret

  • version

  • realm

  • hash_body?

# File lib/oauthenticator/rack_test_signer.rb, line 20
def signing_rack_test(oauth_attrs, &block)
  begin
    Thread.current[:oauthenticator_rack_test_attributes] = oauth_attrs
    return yield
  ensure
    Thread.current[:oauthenticator_rack_test_attributes] = nil
  end
end