cloudspokes/cs-website-cms — pull request #2 by parasquid (2012-11-22 17:24:32+00:00)
Title: Integrate Devise and Refinery

http://www.cloudspokes.com/challenges/1912

Sorry for the mixed pull request, I forgot I was working on master for the spec challenge and I wasn't able to fork before I already made quite a headway in this one :( I promise to make better pull requests for the next time.

I've had to follow this tutorial http://refinerycms.com/guides/with-an-existing-rails-31-devise-app and implement a few refinery patches so that refinery can play well with a devise model that we want to control.

I've created a migration that creates a refinery Superuser with the email admin@example.com and password 'madmin' -- in this setup, only users that have the role of 'Refinery' are able to get into /refinery, and only users that have both 'Refinery' and 'Supertuser' roles will be able to administer the pages. Please see the migration for more details :)

I've made a sample ProtectedController routed to /protected to show what password-protected pages look like. Of course /refinery will also ask for the username/password combo but will only let Refinery users in.

I've started out the rspec and prepared the spec_helper so it would be easy to add the tests. I wanted to submit this now to get the submission time in. I understand I'll be writing in a few more specs if I do win (I'll be adding to this pull request in that case).