Saturday, January 10, 2009

Restful-Authentication with Cucumber features (Step 1)

My latest exercise is to update the restful-authentication Rails plugin to generate Cucumber features instead of RSpec stories. There is already a Lighthouse ticket open for this, so I guess I'm not the first one to think of it. The first steps make sure that restful-authentication is set up correctly:
  1. Create an empty Rails application
  2. Put in version control (git init, git add ., git commit -a -m "init")
  3. Add plugins as shown on the Cucumber Rails wiki page
  4. Add my fork of restful-authentication in the same manner
  5. Complete the restful-authentication installation per the directions
  6. Create the database tables (rake db:migrate)
  7. Run the RSpec stories (stories\rest_auth_stories.rb)
Stories won't even run, let alone pass! I'm not going to show all the errors along the way, but the steps to get to passing stories were:
  1. Added AthenticatedSystem into ApplicationController with the following 2 lines:
      include AuthenticatedSystem
      helper :all # include all helpers, all the time
  2. Uncommented the routes.rb map.root line(map.root :controller => "welcome")
  3. Removed line 1 of user_steps.rb (require File.dirname(__FILE__) + '/../helper')
  4. Created a minimal WelcomeController with an index method
  5. Created a minimal layout
16 scenarios: 16 succeeded, 0 failed, 0 pending
Hurrah!

No comments :

Post a Comment