Just FYI, performed? Is replaced in 3.0 with a check of  
self.response_body.

Sent from my iPhone

On Sep 14, 2009, at 11:46 AM, Chris Didyk <[email protected]> wrote:

>
> Hello,
>
> I'm curious about the performed? method in ActionController::Base.
> It's not documented, but I've found it useful in a specific testing
> scenario that I'll describe below. How is it intended to be used (or
> is it)? Is there a more Railsy way of doing what I'm using it for?
>
> I'm currently in the process of refactoring a large "legacy" Rails app
> (isn't it exciting that these now exist? It was originally something
> like rails 0.13) that had almost zero test coverage. There are some
> kitchen sink methods in ApplicationController that perform redirects
> in certain failure scenarios. From what I can tell, it looks like the
> controllers that call this method rely on their default view rendering
> behavior to avoid DoubleRenderErrors. Before I can refactor such
> behavior out, I need to add test coverage to be sure I don't cause
> unintended side effects.
>
> I'm using rspec and have the following inside
> application_controller_spec.rb:
>
> describe ApplicationController do
>  class TestController < ApplicationController
>    def method_under_test_action
>      method_under_test params[:id]
>      redirect_to '/home/index' unless performed?
>    end
>  end
>  controller_name 'test'
> ...
>
> Without the performed? check, I get less helpful failures
> (DoubleRenderError instead of what is actually triggering the extra
> render in method_under_test). Oh, and the redirect_to '/home/index'
> part is so that I don't get failures for nonexistent view templates
> via a default render call.
>
>
> Best,
> Chris
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to