<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -36,6 +36,7 @@ class MephistoController &lt; ApplicationController
     def dispatch_comments
       show_404 and return unless find_article
       if request.get? || params[:comment].blank?
+        @skip_caching = true
         redirect_to site.permalink_for(@article) and return
       end
     
@@ -97,6 +98,7 @@ class MephistoController &lt; ApplicationController
                                           'next_page'     =&gt; paged_search_url_for(@article_pages.current.next),
                                           'search_string' =&gt; params[:q],
                                           'search_count'  =&gt; search_count)
+      @skip_caching = true
     end
     
     def dispatch_tags</diff>
      <filename>app/controllers/mephisto_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,7 @@ module Mephisto # :nodoc:
     def self.included(base)
       base.helper_method :cached_references
       base.extend ClassMethods
+      base.alias_method_chain :caching_allowed, :skipping
       base.send :attr_writer, :cached_references
     end
 
@@ -24,7 +25,11 @@ module Mephisto # :nodoc:
       def cached_references
         @cached_references ||= []
       end
-      
+
+      def caching_allowed_with_skipping
+        caching_allowed_without_skipping &amp;&amp; !@skip_caching
+      end
+
       # Saves a CachedPage for the current request with the current references.  This is called in an after filter if #caches_page_with_references
       # is used.
       def cache_page_with_references</diff>
      <filename>lib/mephisto/caching_methods.rb</filename>
    </modified>
    <modified>
      <diff>@@ -80,6 +80,37 @@ class CachingTest &lt; ActionController::IntegrationTest
     assert_cached contents(:welcome).full_permalink
   end
 
+  def test_should_not_cache_comment_post
+    visitor = visit
+    assert_expires_pages &quot;#{contents(:welcome).full_permalink}/comments&quot; do
+      visitor.comment_on contents(:welcome), :author =&gt; 'bob', :body =&gt; 'what a wonderful post.'
+    end
+  end
+
+  def test_should_not_cache_comment_post_on_article_with_closed_comments
+    visitor = visit
+    contents(:welcome).update_attribute :comment_age, -1
+    assert_expires_pages &quot;#{contents(:welcome).full_permalink}/comments&quot; do
+      visitor.comment_on contents(:welcome), :author =&gt; 'bob', :body =&gt; 'what a wonderful post.'
+    end
+  end
+
+  def test_should_not_cache_comment_post_on_article_with_invalid_comment
+    visitor = visit
+    assert_expires_pages &quot;#{contents(:welcome).full_permalink}/comments&quot; do
+      assert_no_difference Comment, :count do
+        visitor.comment_on contents(:welcome), {}
+      end
+    end
+  end
+
+  def test_should_not_cache_comments_page_on_get
+    visitor = visit
+    assert_expires_pages &quot;#{contents(:welcome).full_permalink}/comments&quot; do
+      visitor.get &quot;#{contents(:welcome).full_permalink}/comments&quot;
+    end
+  end
+
   def test_should_expire_cache_on_new_comment_if_approved
     visitor = visit
     assert_caches_page contents(:welcome).full_permalink do
@@ -250,6 +281,15 @@ class CachingTest &lt; ActionController::IntegrationTest
     end
   end
 
+  def test_should_not_cache_searches
+    visitor = visit
+    assert_expires_page &quot;/search&quot; do
+      visitor.get  '/search'
+      visitor.get  '/search', :q =&gt; 'foo'
+      visitor.post '/search', :q =&gt; 'foo'
+    end
+  end
+
   protected
     def visit_sections_and_feeds_with(visitor)
       assert_difference CachedPage, :count, 4 do</diff>
      <filename>test/integration/caching_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e525dff691c364199af3c814623e3f1557cfd73e</id>
    </parent>
  </parents>
  <author>
    <name>technoweenie</name>
    <email>technoweenie@567b1171-46fb-0310-a4c9-b4bef9110e78</email>
  </author>
  <url>http://github.com/francois/mephisto/commit/b00a97637b0a8357dc55eef9b625da5eb023ef4e</url>
  <id>b00a97637b0a8357dc55eef9b625da5eb023ef4e</id>
  <committed-date>2006-09-20T18:48:14-07:00</committed-date>
  <authored-date>2006-09-20T18:48:14-07:00</authored-date>
  <message>caching tests, dont cache GET requests to /path/to/article/comments or searches

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2227 567b1171-46fb-0310-a4c9-b4bef9110e78</message>
  <tree>1e6355aa7df5039bc5da6859f87978c53f6c80c6</tree>
  <committer>
    <name>technoweenie</name>
    <email>technoweenie@567b1171-46fb-0310-a4c9-b4bef9110e78</email>
  </committer>
</commit>
