summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_nested_set_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-10-20 09:25:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-10-20 09:25:14 +0000
commit99bf8c95aba29aa2cde30ba8ff39d4d8a37ae9e5 (patch)
tree34693f101f7d9b58f02392972e59fd3255b89213 /test/unit/issue_nested_set_test.rb
parent13e381d31de0055905bd95813fc8034582b2dedc (diff)
downloadredmine-99bf8c95aba29aa2cde30ba8ff39d4d8a37ae9e5.tar.gz
redmine-99bf8c95aba29aa2cde30ba8ff39d4d8a37ae9e5.zip
Fixed that issue nested set update is triggered even if parent is not changed (#15135).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12226 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_nested_set_test.rb')
-rw-r--r--test/unit/issue_nested_set_test.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb
index 3a53eb3af..3c611be28 100644
--- a/test/unit/issue_nested_set_test.rb
+++ b/test/unit/issue_nested_set_test.rb
@@ -166,6 +166,41 @@ class IssueNestedSetTest < ActiveSupport::TestCase
assert_not_equal [], child.errors[:parent_issue_id]
end
+ def test_updating_a_root_issue_should_not_trigger_update_nested_set_attributes_on_parent_change
+ issue = Issue.find(Issue.generate!.id)
+ issue.parent_issue_id = ""
+ issue.expects(:update_nested_set_attributes_on_parent_change).never
+ issue.save!
+ end
+
+ def test_updating_a_child_issue_should_not_trigger_update_nested_set_attributes_on_parent_change
+ issue = Issue.find(Issue.generate!(:parent_issue_id => 1).id)
+ issue.parent_issue_id = "1"
+ issue.expects(:update_nested_set_attributes_on_parent_change).never
+ issue.save!
+ end
+
+ def test_moving_a_root_issue_should_trigger_update_nested_set_attributes_on_parent_change
+ issue = Issue.find(Issue.generate!.id)
+ issue.parent_issue_id = "1"
+ issue.expects(:update_nested_set_attributes_on_parent_change).once
+ issue.save!
+ end
+
+ def test_moving_a_child_issue_to_another_parent_should_trigger_update_nested_set_attributes_on_parent_change
+ issue = Issue.find(Issue.generate!(:parent_issue_id => 1).id)
+ issue.parent_issue_id = "2"
+ issue.expects(:update_nested_set_attributes_on_parent_change).once
+ issue.save!
+ end
+
+ def test_moving_a_child_issue_to_root_should_trigger_update_nested_set_attributes_on_parent_change
+ issue = Issue.find(Issue.generate!(:parent_issue_id => 1).id)
+ issue.parent_issue_id = ""
+ issue.expects(:update_nested_set_attributes_on_parent_change).once
+ issue.save!
+ end
+
def test_destroy_should_destroy_children
issue1 = Issue.generate!
issue2 = Issue.generate!