<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/controllers/stacking_responses_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -144,6 +144,27 @@ RemoveResponseForSpec::TheController.remove_response_for :bar
 RemoveResponseForSpec::TheController.remove_response_for
 - should have empty action_responses
 
-Finished in 0.451715 seconds
-
-79 examples, 0 failures
+StackingResponsesSpec::TheController with responses conditionally executed GET :foo (no conditions)
+- should execute second, then first, response
+- should NOT execute the html response in first
+- should NOT execute the html response in second
+- should render :action =&gt; :foo (the default response)
+
+StackingResponsesSpec::TheController with responses conditionally executed GET :foo, :second =&gt; true
+- should execute second, then first, then in html second, response
+- should redirect from second response
+- should NOT execute first html response
+
+StackingResponsesSpec::TheController with responses conditionally executed GET :foo, :first =&gt; true
+- should execute second, then first, then in first html response
+- should redirect from first response
+- should NOT execute second html response
+
+StackingResponsesSpec::TheController with responses conditionally executed GET :foo, :first =&gt; true, :second =&gt; true (can't execute two html blocks)
+- should execute second, then first, then in second html response
+- should redirect from second response
+- should NOT execute first html response
+
+Finished in 0.729328 seconds
+
+92 examples, 0 failures</diff>
      <filename>SPECDOC</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,3 @@
 require 'ardes/response_for'
-ActionController::Base.send :include, Ardes::ResponseFor
\ No newline at end of file
+ActionController::Base.send :include, Ardes::ResponseFor
+ActionController::MimeResponds::Responder.send :include, Ardes::ResponseFor::Responder
\ No newline at end of file</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 module Ardes #:nodoc:
+  # included into ActionController::Base
   module ResponseFor
     def self.included(base)
       base.class_eval do
@@ -113,13 +114,14 @@ module Ardes #:nodoc:
     
   protected
     # if there are responses for the current action, then respond_to them
+    #
+    # we rescue the case where there were no responses, so that the default_render
+    # action will be performed
     def respond_to_action_responses
       if (responses = self.class.action_responses[action_name]) &amp;&amp; responses.any?
         respond_to do |responder|
-          responses.each do |response|
-            instance_exec(responder, &amp;response)
-          end
-        end
+          responses.each {|response| instance_exec(responder, &amp;response) }
+        end rescue Responder::NoResponsesError
       end
     end
     
@@ -129,5 +131,21 @@ module Ardes #:nodoc:
       respond_to_action_responses
       default_render_without_response_for unless performed?
     end
+    
+    # included into ActionController::MimeResponds::Responder
+    module Responder
+      class NoResponsesError &lt; RuntimeError; end
+      
+      def self.included(responder)
+        responder.class_eval do
+          # we make the responder raise an error if there are no responses
+          def respond_with_response_for
+            raise NoResponseError if @responses.empty?
+            respond_without_response_for
+          end
+          alias_method_chain :respond, :response_for
+        end
+      end
+    end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/ardes/response_for.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7cccbad561f75e7a3f6b3ab1b250d0e852cb47d3</id>
    </parent>
  </parents>
  <author>
    <name>Ian White</name>
    <email>ian.w.white@gmail.com</email>
  </author>
  <url>http://github.com/ianwhite/response_for/commit/8ac908ade87b73d18340fccb10e607123806a879</url>
  <id>8ac908ade87b73d18340fccb10e607123806a879</id>
  <committed-date>2008-09-14T19:43:09-07:00</committed-date>
  <authored-date>2008-09-14T19:43:09-07:00</authored-date>
  <message>Added specs for stacking responses.  Added NoResponsesError which is used internally to handle the case where there are no responses</message>
  <tree>e486a6b328e2c28cfc3f230c28e4508c5af90401</tree>
  <committer>
    <name>Ian White</name>
    <email>ian.w.white@gmail.com</email>
  </committer>
</commit>
