Commit 0f2dfa79ecdeb17d4a2b8972393e9026d225fb24
Committed by
Antonio Terceiro
1 parent
26b0349f
Exists in
master
and in
29 other branches
Expiring article cache after a comment
ActionItem1301
Showing
2 changed files
with
11 additions
and
0 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
test/functional/content_viewer_controller_test.rb
... | ... | @@ -873,4 +873,14 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
873 | 873 | assert_tag :tag => 'a', :content => 'New article' |
874 | 874 | end |
875 | 875 | |
876 | + should 'touch article after adding a comment' do | |
877 | + yesterday = Time.now.yesterday | |
878 | + Article.record_timestamps = false | |
879 | + page = profile.articles.create(:name => 'myarticle', :body => 'the body of the text', :created_at => yesterday, :updated_at => yesterday) | |
880 | + Article.record_timestamps = true | |
881 | + | |
882 | + login_as('ze') | |
883 | + post :view_page, :profile => profile.identifier, :page => [ 'myarticle' ], :comment => { :title => 'crap!', :body => 'I think that this article is crap' } | |
884 | + assert_not_equal yesterday, assigns(:page).updated_at | |
885 | + end | |
876 | 886 | end | ... | ... |