On Wed, Nov 12, 2008 at 10:49 AM, nahum <[EMAIL PROTECTED]> wrote:
>
> Guys,
>
> Does anyone have of any tools or techniques for making and writing
> specs easier that they would recommend?
>
> I'm about to create a whole bunch of controller specs 'after the
> fact', with the primary focus of just getting all actions to
> successfully render.  Maybe a tool which makes round-tripping to the
> dev database easy.

Shoulda has something but they are in the process of getting rid of it.

Here is how I used it.

         context "All actions require login" do
            setup { logout }
            #all actions are denied for non logged in users
            should_be_restful do |resource|
               #you have to be logged in to use the controller for any action
               resource.denied.actions  = [:index, :new, :show,
:create, :edit, :update, :destroy]
               resource.denied.redirect = "new_session_url"
               resource.denied.flash    = /You must be logged in to
access this feature./i
            end
         end #context

all the magic is in should_be_restful which I think is pretty great.

I suppose you can look at the source and modify it to suit your needs too.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"WellRailed" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/WellRailed?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to