RSpec 2, Sinatra and Mongoid example

I spent yesterday coding a very abbreviated version of an authentication service that uses Sinatra, Mongoid and RSpec 2. It took more than a couple hours because there are so many outdated code samples on the web that just don’t work. I put my code up on github for people to see. Just clone the repository and run:

rake spec

While the current example is very basic, I will update it with enhancements and talk more about how to write a good authentication service. For this example I quickly rolled my own basic authentication since the main purpose is to get you up and running quickly with Sinatra, Mongoid, and RSpec2 . I may end up using Authlogic, Devise, or improving on my own authentication functionality.

Get the code here.

Feel free to contribute to the example. Keep in mind this is a service to be consumed by front end apps, not a full application. Also I won’t accept contributions without tests.

No TweetBacks yet. (Be the first to Tweet this post)
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis

If you enjoyed this post, make sure you subscribe to my RSS feed!

This entry was posted in Software and tagged , , , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

2 Comments

  1. Posted August 4, 2011 at 5:41 pm | Permalink

    Greate code!

  2. Doug
    Posted August 21, 2011 at 3:10 am | Permalink

    I might not understand what’s happening… shouldn’t the credentials or session be used by the user end-points? It looks like you could create, update, and retrieve users without ever verifying anything.