From cfb06a2607e338931af0aa1f126c32e3290c4dc2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 6 Apr 2012 17:53:25 +0000 Subject: [PATCH] Additional test for gzipped wiki history. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9366 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/wiki_content_test.rb | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) 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 -- 2.39.5