]> source.dussan.org Git - redmine.git/commitdiff
Additional test for gzipped wiki history.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 6 Apr 2012 17:53:25 +0000 (17:53 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 6 Apr 2012 17:53:25 +0000 (17:53 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9366 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/wiki_content_test.rb

index 6114bdbb6ad9693a1fd523dbdd8b2a20df44a31a..201267ff8f2529e0523c8250f70d9d9941100ecc 100644 (file)
@@ -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