public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
enable cache sweepers for article deletion

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1491 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sun Aug 06 01:55:49 -0700 2006
commit  53b8690ddd781424d800e88539c99136d8e5813a
tree    01d7f029309ba4f12dc69ba86cca5286d69b4963
parent  00bc39768e408eeca7d0a8a77156f1fe0a81f271
...
1
2
 
3
4
5
...
1
 
2
3
4
5
0
@@ -1,5 +1,5 @@
0
 class Admin::ArticlesController < Admin::BaseController
0
- with_options :only => [:create, :update] do |c|
0
+ with_options :only => [:create, :update, :destroy] do |c|
0
     c.before_filter :set_default_section_ids
0
     c.cache_sweeper :article_sweeper, :section_sweeper, :assigned_section_sweeper
0
     cache_sweeper :comment_sweeper, :only => [:approve, :unapprove, :destroy_comment]
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@ class Article < Content
0
     end
0
   end
0
 
0
- has_many :assigned_sections, :dependent => :delete_all
0
+ has_many :assigned_sections, :dependent => :destroy
0
   has_many :sections, :through => :assigned_sections, :order => 'sections.name'
0
   has_many :events, :order => 'created_at desc', :dependent => :delete_all
0
   with_options :order => 'created_at', :class_name => 'Comment' do |comment|
...
50
51
52
 
 
 
 
 
53
54
55
...
50
51
52
53
54
55
56
57
58
59
60
0
@@ -50,6 +50,11 @@ module Mephisto
0
         assert_redirected_to "/admin/articles"
0
       end
0
 
0
+ def remove_article(article)
0
+ post "/admin/articles/destroy/#{article.id}"
0
+ assert_equal 200, status, "Removing article #{article.id}"
0
+ end
0
+
0
       def create(params)
0
         post '/admin/articles/create', to_article_params(params)
0
         assert_redirected_to "/admin/articles"
...
193
194
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
197
198
...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
0
@@ -193,6 +193,22 @@ class CachingTest < ActionController::IntegrationTest
0
     end
0
   end
0
 
0
+ def test_should_expire_section_and_article_cache_when_deleting_article
0
+ visitor = visit
0
+
0
+ visit_sections_and_feeds_with visitor
0
+ visitor.read contents(:site_map)
0
+
0
+ assert_expires_pages feed_url_for(:about), section_url_for(:about), contents(:site_map).full_permalink do
0
+ login_as :quentin do |writer|
0
+ writer.remove_article contents(:site_map)
0
+ end
0
+ end
0
+
0
+ assert_cached section_url_for(:home)
0
+ assert_cached feed_url_for(:home)
0
+ end
0
+
0
   protected
0
     def visit_sections_and_feeds_with(visitor)
0
       assert_difference CachedPage, :count, 4 do

Comments

    No one has commented yet.