Module: OAuthenticator::RackTestSigner

Included in:
OAuthenticator
Defined in:
lib/oauthenticator/rack_test_signer.rb

Instance Method Summary collapse

Instance Method Details

#signing_rack_test(oauth_attrs, &block) ⇒ Object

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 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 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?


20
21
22
23
24
25
26
27
# 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