Skip to content

Instantly share code, notes, and snippets.

@jrep
jrep / gist:1470172
Created December 13, 2011 02:24
Rspec and HTTP_AUTHORIZATION
# I'm trying to add HTTP BasicAuth to an existing Rails API (not app - no pages or views).
#
# At http://blog.matthodan.com/how-to-test-something-with-rspec
# (and a thousand or so other places)
# I find that it's easy to test this:
describe SourcesController do
describe "#index" do
before :each do
@request.env['HTTP_AUTHORIZATION']
@jrep
jrep / current
Created December 13, 2011 22:57
adding non-ralisy urls, routes, classes
# Existing requests (all working):
POST /1/organizations => creates a new Organization
GET /1/organizations => show Organizations
GET /1/organizations/13 => show Organizations[13]
# and so on.
# Current routes.rb: