Hey Ian,

This isn't specific to OAuth, but I mix in this API macros module to my
tests (I generally use rspec/rack-test for API testing):

https://gist.github.com/bensie/9006703

Then in specs that require auth, I use authorize_token(token) or
authorize_basic(user, pass). Nothing fancy, but it works.

James


On Fri, Feb 14, 2014 at 10:45 AM, Ian Young <[email protected]> wrote:

>  This seems like a common need, so thought I'd check and see if anyone
> knows of a nice way to handle this. I keep ending up writing specs against
> authenticated API endpoints, and want a nice way to a) encapsulate the
> repetitive work of creating credentials for a user, and b) automatically
> pass the credentials in the preferred form (HTTP header, extra query param,
> whatever) on all authenticated requests. I hate having a test suite where
> every request has `{"Authorization": "token #{access_token}"}` cluttering
> it up. I use rspec, but would assume that most solutions would be equally
> viable in MiniTest.
>
> --
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
> ---
> You received this message because you are subscribed to the Google Groups
> "SD Ruby" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
--- 
You received this message because you are subscribed to the Google Groups "SD 
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to