OpenID testing in rails
Posted by dnite on March 2, 2007
UPDATE: I’ve moved my blog to http://blog.dnite.org and updated this into a real plugin. You can check it (and anything else I have going on) over there.
It’s all the rage lately. OpenID has quickly become huge as of late. With huge companies like digg, microsoft and aol picking up and supporting OpenID, it’s just a matter of time before we’re all basking in OpenID glory and wondering what we ever did without it.
For those of you not in the know, OpenID presents a decentralized universal login. Basically, your URL is your login name. When you visit a site that accepts OpenID logins, you give them your OpenID URL and your forwarded to your OpenID server to log in. Once you log in, your redirected back to where you came from pretty seamlessly. It’s really cool stuff with a lot of potential. It offers a nice speed bump for spammers on a lot of blogs. It also offers a way for people to keep track of the same person across multiple sites. If you have a friend you met on xyz.com, you can rest assured that it is the same person you happened across on abc.com as well.
Less than a week ago, DHH added a plugin to the official Rails subversion repository that wraps around some of the lose ends for accepting OpenID logins in your Rails application. It’s early in development but it works quite well. Pick it up and read through the README for basic instructions on how to get things working.
Recently, I started training myself to do Test Driven Development. I bought the GREAT peepcode screencast on the topic and got started. This means that I’m writing tests for everything and I essentially won’t really look at my site until it’s close to done. So after I implemented OpenID into my new application, I needed a way to write some tests for it. I didn’t want to hammer a OpenID server with constant testing so I wrote up a ‘stub’ that I figured I’d share with others wishing to write tests for their OpenID applications. It’s very basic right now. I’ll probably improve it shortly down the road, but for right now. It’ll do.