summaryrefslogtreecommitdiffstats
path: root/test/unit/wiki_page_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-26 16:43:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-26 16:43:19 +0000
commit9f346d592137089123d97a988c1293ce908a0033 (patch)
treeb46e3f91afc7012446e30b3ee84ed38572104283 /test/unit/wiki_page_test.rb
parent71423af0b2029922fe1de50bf3b7ccc2315d2e91 (diff)
downloadredmine-9f346d592137089123d97a988c1293ce908a0033.tar.gz
redmine-9f346d592137089123d97a988c1293ce908a0033.zip
Make sure that something was actually deleted.
git-svn-id: http://svn.redmine.org/redmine/trunk@16890 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/wiki_page_test.rb')
-rw-r--r--test/unit/wiki_page_test.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb
index 21744572c..af08815ff 100644
--- a/test/unit/wiki_page_test.rb
+++ b/test/unit/wiki_page_test.rb
@@ -139,11 +139,16 @@ class WikiPageTest < ActiveSupport::TestCase
assert_nil child.parent_id
end
- def test_destroy
+ def test_destroy_should_delete_content_and_its_versions
page = WikiPage.find(1)
- page.destroy
+ assert_difference 'WikiPage.count', -1 do
+ assert_difference 'WikiContent.count', -1 do
+ assert_difference 'WikiContentVersion.count', -3 do
+ page.destroy
+ end
+ end
+ end
assert_nil WikiPage.find_by_id(1)
- # make sure that page content and its history are deleted
assert_equal 0, WikiContent.where(:page_id => 1).count
assert_equal 0, WikiContentVersion.where(:page_id => 1).count
end