<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>Rakefile</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -23,13 +23,13 @@ module ActionController
     
     module InstanceMethods
       def cache_embedded?(options)
-        cache_this_instance = options.delete :caching # the rest of the request processing code doesn't have to know about this option
-
+        cache_this_instance = options[:params] &amp;&amp; options[:params].delete(:caching) # the rest of the request processing code doesn't have to know about this option
         return false unless self.perform_caching
     
         if embedded_class(options).cached_embedded[options[:action].to_sym]
           return true unless cache_this_instance == false
         end
+
         return cache_this_instance
       end
 
@@ -38,7 +38,7 @@ module ActionController
       end
   
       def embed_action_as_string_with_caching(options)
-        force_refresh = options.delete :refresh_cache
+        force_refresh = options[:params] &amp;&amp; options[:params].delete(:refresh_cache)
         return embed_action_as_string_without_caching(options) unless self.cache_embedded?(options)
 
         unless not force_refresh and cached = send(:read_fragment, options)</diff>
      <filename>lib/embedded_actions/caches_embedded.rb</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,23 @@ class TestController &lt; ActionController::Base
   end
   
   def dump_params
+    render :inline =&gt; 'Params: &lt;%= params.keys.sort.collect {|name| &quot;#{name}: #{params[name]}&quot;}.join &quot;, &quot; %&gt;'
   end  
+
+  def action_with_respond_to
+    respond_to do |format|
+      format.html     { render :inline =&gt; &quot;html content&quot;     }
+      format.embedded { render :inline =&gt; &quot;embedded content&quot; }
+      format.all      { render :inline =&gt; &quot;catch all&quot; }
+    end
+  end
+
+  def action_that_calls_action_with_respond_to
+    render :inline =&gt; &quot;&lt;%= embed_action :action =&gt; 'action_with_respond_to' %&gt;&quot;
+  end
+
+  def inline_erb_action
+    render :inline =&gt; params[:erb]
+  end
 end
 </diff>
      <filename>test/rails/app/controllers/test_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,11 +37,11 @@ class Test::Unit::TestCase
 
 
   def assert_embed_erb(result, erb, msg = nil)
-    TestController.send(:define_method, :test_action, Proc.new do
+    (class &lt;&lt; @controller; self; end).send(:define_method, :test_action_for_assert_embed_erb, Proc.new do
       render :inline =&gt; erb
     end)
     
-    get :test_action
+    get :test_action_for_assert_embed_erb
     assert_equal result, @response.body, msg
   end
 end</diff>
      <filename>test/rails/test/test_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,13 +9,7 @@ require File.expand_path(File.dirname(__FILE__) + &quot;/rails/test/test_helper&quot;)
 # Re-raise errors caught by the controller.
 class TestController; def rescue_action(e) raise e end; end
 
-class TestController
-  def default_url_options(options)
-    {:id =&gt; 15, :category =&gt; &quot;red&quot;}
-  end
-end
-
-class TestControllerWithDefaultUrlOptions &lt; TestController
+class TestControllerWithLessDefaultUrlOptions &lt; TestController
   def default_url_options(options)
     {:id =&gt; 15}
   end
@@ -38,12 +32,14 @@ end
 
 class DefaultEmbeddedOptionsTest &lt; Test::Unit::TestCase
   def setup
-    @controller = TestController.new
     @request    = ActionController::TestRequest.new
     @response   = ActionController::TestResponse.new
+    FileUtils.rm_rf &quot;#{RAILS_ROOT}/tmp/cache/test.host&quot;
   end
 
   def test_normalize_embedded_options
+    @controller = TestControllerWithMoreDefaultUrlOptions.new
+
     assert_equal({:id =&gt; 1, :params =&gt; {:category =&gt; &quot;red&quot;}}, @controller.normalize_embedded_options({:id =&gt; 1, :category =&gt; &quot;red&quot;}))
     assert_equal({:id =&gt; 1, :params =&gt; {:category =&gt; &quot;red&quot;}}, @controller.normalize_embedded_options({:id =&gt; 1, :params =&gt; {:category =&gt; &quot;red&quot;}}))
     assert_equal({:params =&gt; {:category =&gt; &quot;blue&quot;}}, @controller.normalize_embedded_options({:category =&gt; &quot;blue&quot;}))
@@ -51,7 +47,7 @@ class DefaultEmbeddedOptionsTest &lt; Test::Unit::TestCase
   end
   
   def test_default_url_options
-    @controller = TestControllerWithDefaultUrlOptions.new
+    @controller = TestControllerWithLessDefaultUrlOptions.new
     
     assert_equal({:id =&gt; 15}, @controller.rewrite_embedded_options({}))
     assert_equal({:id =&gt; 16}, @controller.rewrite_embedded_options({:id =&gt; 16}))
@@ -72,23 +68,19 @@ class DefaultEmbeddedOptionsTest &lt; Test::Unit::TestCase
   end
   
   def test_embed_action_with_default_options
-    @controller = TestController.new
+    @controller = TestControllerWithMoreDefaultUrlOptions.new
 
-    assert_embed_erb &quot;Params: action: dump_params, category: red, controller: test, id: 15\n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params' %&gt;&quot;,
-                     &quot;embed_action should use default options&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params' %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, category: red, controller: test_controller_with_more_default_url_options, id: 15&quot;, @response.body, &quot;embed_action should use default options&quot;
 
-    assert_embed_erb &quot;Params: action: dump_params, category: red, controller: test, id: 16\n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 16 %&gt;&quot;,
-                     &quot;embed_action should use default options&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 16 %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, category: red, controller: test_controller_with_more_default_url_options, id: 16&quot;, @response.body, &quot;embed_action should use default options&quot;
 
-    assert_embed_erb &quot;Params: action: dump_params, category: blue, controller: test, id: 16\n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 16, :category =&gt; 'blue' %&gt;&quot;,
-                     &quot;embed_action should use default options&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 16, :category =&gt; 'blue' %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, category: blue, controller: test_controller_with_more_default_url_options, id: 16&quot;, @response.body, &quot;embed_action should use default options&quot;
 
-    assert_embed_erb &quot;Params: action: dump_params, category: blue, controller: test, id: 16\n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 16, :params =&gt; {:category =&gt; 'blue'} %&gt;&quot;,
-                     &quot;embed_action should use default options&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 16, :params =&gt; {:category =&gt; 'blue'} %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, category: blue, controller: test_controller_with_more_default_url_options, id: 16&quot;, @response.body, &quot;embed_action should use default options&quot;
   end
   
 end</diff>
      <filename>test/test_default_embedded_options.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,33 +18,26 @@ class EmbeddedActionTest &lt; Test::Unit::TestCase
   end
 
   def test_embed_action
-    assert_embed_erb &quot;Params: action: dump_params, controller: test, id: \n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params' %&gt;&quot;,
-                     &quot;embed_action should accept implicit controller&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params' %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, controller: test, id: &quot;, @response.body, &quot;embed_action should accept implicit controller&quot;
 
-    assert_embed_erb &quot;Params: action: dump_params, controller: test, id: \n&quot;, 
-                     &quot;&lt;%= embed_action :controller =&gt; 'test', :action =&gt; 'dump_params' %&gt;&quot;,
-                     &quot;embed_action should accept explicit controller&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :controller =&gt; 'test', :action =&gt; 'dump_params' %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, controller: test, id: &quot;, @response.body, &quot;embed_action should accept explicit controller&quot;
                      
-    assert_embed_erb &quot;Params: action: dump_params, controller: test, id: the id\n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id' %&gt;&quot;,
-                     &quot;embed_action should pass the id&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id' %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, controller: test, id: the id&quot;, @response.body, &quot;embed_action should pass the id&quot;
                      
-    assert_embed_erb &quot;Params: action: dump_params, color: blue, controller: test, id: the id\n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id', :params =&gt; {:color =&gt; 'blue'} %&gt;&quot;,
-                     &quot;embed_action should pass params as expected&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id', :params =&gt; {:color =&gt; 'blue'} %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, color: blue, controller: test, id: the id&quot;, @response.body, &quot;embed_action should pass params as expected&quot;
                      
-    assert_embed_erb &quot;Params: action: dump_params, color: blue, controller: test, id: the id\n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id', :color =&gt; 'blue' %&gt;&quot;,
-                     &quot;embed_action should merge into params anything that's not standard&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id', :color =&gt; 'blue' %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, color: blue, controller: test, id: the id&quot;, @response.body, &quot;embed_action should merge into params anything that's not standard&quot;
                      
-    assert_embed_erb &quot;Params: action: dump_params, color: red, controller: test, id: the id\n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id', :color =&gt; 'blue', :params =&gt; {:color =&gt; 'red'} %&gt;&quot;,
-                     &quot;embed_action should override with the contents of params&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id', :color =&gt; 'blue', :params =&gt; {:color =&gt; 'red'} %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, color: red, controller: test, id: the id&quot;, @response.body, &quot;embed_action should override with the contents of params&quot;
 
-    assert_embed_erb &quot;Params: action: dump_params, color: red, controller: test, id: the id\n&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id', :color =&gt; 'blue', :params =&gt; {'color' =&gt; 'red'} %&gt;&quot;,
-                     &quot;embed_action should allow indifferent access&quot;
+    get :inline_erb_action, :erb =&gt; &quot;&lt;%= embed_action :action =&gt; 'dump_params', :id =&gt; 'the id', :color =&gt; 'blue', :params =&gt; {'color' =&gt; 'red'} %&gt;&quot;
+    assert_equal &quot;Params: action: dump_params, color: red, controller: test, id: the id&quot;, @response.body, &quot;embed_action should allow indifferent access&quot;
   end
 
 end</diff>
      <filename>test/test_embedded_action.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,26 +14,16 @@ class RespondsToTest &lt; Test::Unit::TestCase
     @controller = TestController.new
     @request    = ActionController::TestRequest.new
     @response   = ActionController::TestResponse.new
+    FileUtils.rm_rf &quot;#{RAILS_ROOT}/tmp/cache/test.host&quot;
   end
 
   def test_responds_to_embedded
-    TestController.class_eval do
-      def action_with_respond_to
-        respond_to do |format|
-          format.html     { render :inline =&gt; &quot;html content&quot;     }
-          format.embedded { render :inline =&gt; &quot;embedded content&quot; }
-          format.all      { render :inline =&gt; &quot;catch all&quot; }
-        end
-      end
-    end
-    
-    assert_embed_erb &quot;embedded content&quot;, 
-                     &quot;&lt;%= embed_action :action =&gt; 'action_with_respond_to' %&gt;&quot;,
-                     &quot;should respond with embedded content&quot;
-    assert_equal &quot;text/html&quot;, @response.content_type
-
     get :action_with_respond_to
     assert_equal &quot;html content&quot;, @response.body, &quot;should respond with html content&quot;
     assert_equal &quot;text/html&quot;, @response.content_type
+
+    get :action_that_calls_action_with_respond_to
+    assert_equal &quot;embedded content&quot;, @response.body, &quot;should respond with html content&quot;
+    assert_equal &quot;text/html&quot;, @response.content_type
   end
 end</diff>
      <filename>test/test_responds_to.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9cc2422f239bb5de88f0bf6cb63854ace65f537f</id>
    </parent>
  </parents>
  <author>
    <name>sd</name>
    <email>sd@71bf3dff-0d17-0410-8985-d5c41cf5d41c</email>
  </author>
  <url>http://github.com/sd/embedded-actions/commit/6b2494809ddaf6a68c46dcc367fa3e47e9eeee9b</url>
  <id>6b2494809ddaf6a68c46dcc367fa3e47e9eeee9b</id>
  <committed-date>2007-10-08T08:38:21-07:00</committed-date>
  <authored-date>2007-10-08T08:38:21-07:00</authored-date>
  <message> r63@chuao:  sd | 2007-10-08 11:35:59 -0400
 Tests now pass cleanly


git-svn-id: https://dev.notso.net/svn/rails/plugins/embedded_actions/trunk@125 71bf3dff-0d17-0410-8985-d5c41cf5d41c</message>
  <tree>6ee57b4a350aef31d5e3b16fd47280c4b1ca0edc</tree>
  <committer>
    <name>sd</name>
    <email>sd@71bf3dff-0d17-0410-8985-d5c41cf5d41c</email>
  </committer>
</commit>
