Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2009-08-04 00:08:01 -05:00
commit 96defb0945
4 changed files with 16 additions and 1 deletions

View file

@ -6,6 +6,12 @@ class RevisionSweeper < ActionController::Caching::Sweeper
observe Revision, Page
def before_save(record)
if record.is_a?(Revision)
expire_cached_revisions(record.page)
end
end
def after_save(record)
if record.is_a?(Revision)
expire_caches(record.page)

View file

@ -250,8 +250,12 @@ class WikiController < ApplicationController
def rollback
get_page_and_revision
if @page.locked?(Time.now) and not params['break_lock']
redirect_to :web => @web_name, :action => 'locked', :id => @page_name
else
@page.lock(Time.now, @author)
end
end
def save
render(:status => 404, :text => 'Undefined page name', :layout => 'error') and return if @page_name.nil? or not @page_name.is_utf8?

View file

@ -427,11 +427,15 @@ class WikiControllerTest < ActionController::TestCase
def test_rollback
# rollback shows a form where a revision can be edited.
# its assigns the same as or revision
home_page = Page.find(@home.id)
assert !home_page.locked?(Time.now)
r = process 'rollback', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '1'
assert_response(:success)
assert_equal @home, r.template_objects['page']
assert_equal @home.revisions[0], r.template_objects['revision']
home_page = Page.find(@home.id)
assert home_page.locked?(Time.now)
end
def test_atom_with_content

View file

@ -543,6 +543,7 @@ END_THM
Revision.create(:page => @page, :content => 'What a red and lovely morning today',
:author => Author.new('DavidHeinemeierHansson'), :revised_at => Time.now)
@page.reload
assert_equal "<p><span> What a<del class='diffmod'> blue</del><ins class='diffmod'> red" +
"</ins> and lovely morning<ins class='diffins'> today</ins></span></p>", test_renderer(@page.revisions.last).display_diff
end