Using ActionController::Base#performed?

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

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