From: Jean-Philippe Lang Date: Fri, 6 Apr 2012 17:53:25 +0000 (+0000) Subject: Additional test for gzipped wiki history. X-Git-Tag: 2.0.0~216 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cfb06a2607e338931af0aa1f126c32e3290c4dc2;p=redmine.git Additional test for gzipped wiki history. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9366 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/unit/wiki_content_test.rb b/test/unit/wiki_content_test.rb index 6114bdbb6..201267ff8 100644 --- a/test/unit/wiki_content_test.rb +++ b/test/unit/wiki_content_test.rb @@ -53,14 +53,38 @@ class WikiContentTest < ActiveSupport::TestCase assert_equal 1, ActionMailer::Base.deliveries.size end - def test_update + def test_update_should_be_versioned content = @page.content version_count = content.version content.text = "My new content" - assert content.save + assert_difference 'WikiContent::Version.count' do + assert content.save + end content.reload assert_equal version_count+1, content.version assert_equal version_count+1, content.versions.length + + version = WikiContent::Version.first(:order => 'id DESC') + assert_equal @page.id, version.page_id + assert_equal '', version.compression + assert_equal "My new content", version.data + assert_equal "My new content", version.text + end + + def test_update_with_gzipped_history + with_settings :wiki_compression => 'gzip' do + content = @page.content + content.text = "My new content" + assert_difference 'WikiContent::Version.count' do + assert content.save + end + end + + version = WikiContent::Version.first(:order => 'id DESC') + assert_equal @page.id, version.page_id + assert_equal 'gzip', version.compression + assert_not_equal "My new content", version.data + assert_equal "My new content", version.text end def test_update_should_send_email_notification