##// END OF EJS Templates
Clean up sort orders....
Clean up sort orders. git-svn-id: http://svn.redmine.org/redmine/trunk@16321 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r15729:b58cf253838b
r15939:fe906e4fb6b3
Show More
issue_nested_set_test.rb
328 lines | 11.5 KiB | text/x-ruby | RubyLexer
/ test / unit / issue_nested_set_test.rb
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685 #
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685 #
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459
class IssueNestedSetTest < ActiveSupport::TestCase
Jean-Philippe Lang
Removed unused fixtures....
r11091 fixtures :projects, :users, :roles,
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 :trackers, :projects_trackers,
Jean-Philippe Lang
Removed unused fixtures....
r11091 :issue_statuses, :issue_categories, :issue_relations,
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 :enumerations,
Jean-Philippe Lang
Removed unused fixtures....
r11091 :issues
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459
Toshi MARUYAMA
move awesome_nested_set leaf? modification to config/initializers/10-patches.rb...
r12407 def test_new_record_is_leaf
i = Issue.new
assert i.leaf?
end
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_create_root_issue
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft1 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 issue1 = Issue.generate!
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft2 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 issue2 = Issue.generate!
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 issue1.reload
issue2.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [issue1.id, nil, lft1, lft1 + 1], [issue1.root_id, issue1.parent_id, issue1.lft, issue1.rgt]
assert_equal [issue2.id, nil, lft2, lft2 + 1], [issue2.root_id, issue2.parent_id, issue2.lft, issue2.rgt]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_create_child_issue
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 child = parent.generate_child!
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 parent.reload
child.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [parent.id, nil, lft, lft + 3], [parent.root_id, parent.parent_id, parent.lft, parent.rgt]
assert_equal [parent.id, parent.id, lft + 1, lft + 2], [child.root_id, child.parent_id, child.lft, child.rgt]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds a setting to allow subtasks to belong to other projects (#5487)....
r10376 def test_creating_a_child_in_a_subproject_should_validate
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 issue = Issue.generate!
Jean-Philippe Lang
Adds a setting to allow subtasks to belong to other projects (#5487)....
r10376 child = Issue.new(:project_id => 3, :tracker_id => 2, :author_id => 1,
:subject => 'child', :parent_issue_id => issue.id)
assert_save child
assert_equal issue, child.reload.parent
end
def test_creating_a_child_in_an_invalid_project_should_not_validate
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 issue = Issue.generate!
Toshi MARUYAMA
code layout clean up of test/unit/issue_nested_set_test.rb...
r7475 child = Issue.new(:project_id => 2, :tracker_id => 1, :author_id => 1,
:subject => 'child', :parent_issue_id => issue.id)
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 assert !child.save
Toshi MARUYAMA
not use assert_not_nil in Errors#[]...
r11840 assert_not_equal [], child.errors[:parent_issue_id]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_move_a_root_to_child
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent1 = Issue.generate!
parent2 = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 child = parent1.generate_child!
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 parent2.parent_issue_id = parent1.id
parent2.save!
child.reload
parent1.reload
parent2.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [parent1.id, lft, lft + 5], [parent1.root_id, parent1.lft, parent1.rgt]
Jean-Philippe Lang
Insert children issues to respect same order as ids....
r13460 assert_equal [parent1.id, lft + 1, lft + 2], [parent2.root_id, parent2.lft, parent2.rgt]
assert_equal [parent1.id, lft + 3, lft + 4], [child.root_id, child.lft, child.rgt]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_move_a_child_to_root
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft1 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent1 = Issue.generate!
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft2 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent2 = Issue.generate!
Toshi MARUYAMA
fix race condition of highest rgt at Issue#update_nested_set_attributes_on_parent_change (#6579)...
r12736 lft3 = new_issue_lft
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 child = parent1.generate_child!
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 child.parent_issue_id = nil
child.save!
child.reload
parent1.reload
parent2.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [parent1.id, lft1, lft1 + 1], [parent1.root_id, parent1.lft, parent1.rgt]
assert_equal [parent2.id, lft2, lft2 + 1], [parent2.root_id, parent2.lft, parent2.rgt]
Toshi MARUYAMA
fix race condition of highest rgt at Issue#update_nested_set_attributes_on_parent_change (#6579)...
r12736 assert_equal [child.id, lft3, lft3 + 1], [child.root_id, child.lft, child.rgt]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_move_a_child_to_another_issue
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft1 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent1 = Issue.generate!
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft2 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent2 = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 child = parent1.generate_child!
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 child.parent_issue_id = parent2.id
child.save!
child.reload
parent1.reload
parent2.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [parent1.id, lft1, lft1 + 1], [parent1.root_id, parent1.lft, parent1.rgt]
assert_equal [parent2.id, lft2, lft2 + 3], [parent2.root_id, parent2.lft, parent2.rgt]
assert_equal [parent2.id, lft2 + 1, lft2 + 2], [child.root_id, child.lft, child.rgt]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_move_a_child_with_descendants_to_another_issue
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft1 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent1 = Issue.generate!
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft2 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent2 = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 child = parent1.generate_child!
grandchild = child.generate_child!
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 parent1.reload
parent2.reload
child.reload
grandchild.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [parent1.id, lft1, lft1 + 5], [parent1.root_id, parent1.lft, parent1.rgt]
assert_equal [parent2.id, lft2, lft2 + 1], [parent2.root_id, parent2.lft, parent2.rgt]
assert_equal [parent1.id, lft1 + 1, lft1 + 4], [child.root_id, child.lft, child.rgt]
assert_equal [parent1.id, lft1 + 2, lft1 + 3], [grandchild.root_id, grandchild.lft, grandchild.rgt]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 child.reload.parent_issue_id = parent2.id
child.save!
child.reload
grandchild.reload
parent1.reload
parent2.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [parent1.id, lft1, lft1 + 1], [parent1.root_id, parent1.lft, parent1.rgt]
assert_equal [parent2.id, lft2, lft2 + 5], [parent2.root_id, parent2.lft, parent2.rgt]
assert_equal [parent2.id, lft2 + 1, lft2 + 4], [child.root_id, child.lft, child.rgt]
assert_equal [parent2.id, lft2 + 2, lft2 + 3], [grandchild.root_id, grandchild.lft, grandchild.rgt]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_move_a_child_with_descendants_to_another_project
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft1 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent1 = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 child = parent1.generate_child!
grandchild = child.generate_child!
Toshi MARUYAMA
fix race condition of highest rgt at Issue#update_nested_set_attributes_on_parent_change (#6579)...
r12736 lft4 = new_issue_lft
Jean-Philippe Lang
Deprecated Issue#move_to_project....
r8419 child.reload
child.project = Project.find(2)
assert child.save
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 child.reload
grandchild.reload
parent1.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [1, parent1.id, lft1, lft1 + 1], [parent1.project_id, parent1.root_id, parent1.lft, parent1.rgt]
Toshi MARUYAMA
fix race condition of highest rgt at Issue#update_nested_set_attributes_on_parent_change (#6579)...
r12736 assert_equal [2, child.id, lft4, lft4 + 3],
[child.project_id, child.root_id, child.lft, child.rgt]
assert_equal [2, child.id, lft4 + 1, lft4 + 2],
[grandchild.project_id, grandchild.root_id, grandchild.lft, grandchild.rgt]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_moving_an_issue_to_a_descendant_should_not_validate
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent1 = Issue.generate!
parent2 = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 child = parent1.generate_child!
grandchild = child.generate_child!
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 child.reload
child.parent_issue_id = grandchild.id
assert !child.save
Toshi MARUYAMA
not use assert_not_nil in Errors#[]...
r11840 assert_not_equal [], child.errors[:parent_issue_id]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Fixed that issue nested set update is triggered even if parent is not changed (#15135)....
r11996 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
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_destroy_should_destroy_children
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft1 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 issue1 = Issue.generate!
issue2 = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 issue3 = issue2.generate_child!
issue4 = issue1.generate_child!
Jean-Philippe Lang
Fixed: subtasks are deleted (not destroyed) when destroying parent issue (#7385)....
r4615 issue3.init_journal(User.find(2))
issue3.subject = 'child with journal'
issue3.save!
assert_difference 'Issue.count', -2 do
assert_difference 'Journal.count', -1 do
assert_difference 'JournalDetail.count', -1 do
Issue.find(issue2.id).destroy
end
end
end
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 issue1.reload
issue4.reload
assert !Issue.exists?(issue2.id)
assert !Issue.exists?(issue3.id)
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [issue1.id, lft1, lft1 + 3], [issue1.root_id, issue1.lft, issue1.rgt]
assert_equal [issue1.id, lft1 + 1, lft1 + 2], [issue4.root_id, issue4.lft, issue4.rgt]
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418
Jean-Philippe Lang
Fixed: Deleting a subtasks doesn't update parent's rgt & lft values, introduced by r5286 (#9577)....
r7694 def test_destroy_child_should_update_parent
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft1 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 issue = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 child1 = issue.generate_child!
child2 = issue.generate_child!
Jean-Philippe Lang
Fixed: Deleting a subtasks doesn't update parent's rgt & lft values, introduced by r5286 (#9577)....
r7694 issue.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [issue.id, lft1, lft1 + 5], [issue.root_id, issue.lft, issue.rgt]
Jean-Philippe Lang
Fixed: Deleting a subtasks doesn't update parent's rgt & lft values, introduced by r5286 (#9577)....
r7694 child2.reload.destroy
issue.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [issue.id, lft1, lft1 + 3], [issue.root_id, issue.lft, issue.rgt]
Jean-Philippe Lang
Fixed: Deleting a subtasks doesn't update parent's rgt & lft values, introduced by r5286 (#9577)....
r7694 end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Fixed: deleting a parent issue may lead to a stale object error (#7920)....
r5165 def test_destroy_parent_issue_updated_during_children_destroy
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 parent.generate_child!(:start_date => Date.today)
parent.generate_child!(:start_date => 2.days.from_now)
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Fixed: deleting a parent issue may lead to a stale object error (#7920)....
r5165 assert_difference 'Issue.count', -3 do
Issue.find(parent.id).destroy
end
end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Fixed: subtasks are deleted (not destroyed) when destroying parent issue (#7385)....
r4615 def test_destroy_child_issue_with_children
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 root = Issue.generate!
child = root.generate_child!
leaf = child.generate_child!
Jean-Philippe Lang
Fixed: subtasks are deleted (not destroyed) when destroying parent issue (#7385)....
r4615 leaf.init_journal(User.find(2))
leaf.subject = 'leaf with journal'
leaf.save!
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Fixed: subtasks are deleted (not destroyed) when destroying parent issue (#7385)....
r4615 assert_difference 'Issue.count', -2 do
assert_difference 'Journal.count', -1 do
assert_difference 'JournalDetail.count', -1 do
Issue.find(child.id).destroy
end
end
end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Fixed: subtasks are deleted (not destroyed) when destroying parent issue (#7385)....
r4615 root = Issue.find(root.id)
assert root.leaf?, "Root issue is not a leaf (lft: #{root.lft}, rgt: #{root.rgt})"
end
Toshi MARUYAMA
remove trailing white-spaces from test/unit/issue_nested_set_test.rb....
r6630
Jean-Philippe Lang
Fixed: Error deleting issue with grandchild (#8880)....
r6191 def test_destroy_issue_with_grand_child
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 lft1 = new_issue_lft
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 parent = Issue.generate!
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 issue = parent.generate_child!
child = issue.generate_child!
grandchild1 = child.generate_child!
grandchild2 = child.generate_child!
Jean-Philippe Lang
Fixed: Error deleting issue with grandchild (#8880)....
r6191 assert_difference 'Issue.count', -4 do
Issue.find(issue.id).destroy
parent.reload
Toshi MARUYAMA
adjust tests to awesome_nested_set new node lft and rgt value behavior change...
r12418 assert_equal [lft1, lft1 + 1], [parent.lft, parent.rgt]
Jean-Philippe Lang
Fixed: Error deleting issue with grandchild (#8880)....
r6191 end
end
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 def test_project_copy_should_copy_issue_tree
p = Project.create!(:name => 'Tree copy', :identifier => 'tree-copy', :tracker_ids => [1, 2])
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 i1 = Issue.generate!(:project => p, :subject => 'i1')
Jean-Philippe Lang
Adds some test helpers to cleanup tests....
r12471 i2 = i1.generate_child!(:project => p, :subject => 'i2')
i3 = i1.generate_child!(:project => p, :subject => 'i3')
i4 = i2.generate_child!(:project => p, :subject => 'i4')
Jean-Philippe Lang
Removed issue_create! helper in favour of Issue.generate!...
r10402 i5 = Issue.generate!(:project => p, :subject => 'i5')
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 c = Project.new(:name => 'Copy', :identifier => 'copy', :tracker_ids => [1, 2])
c.copy(p, :only => 'issues')
c.reload
Toshi MARUYAMA
remove trailing white-spaces from unit issue nested set test....
r5685
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 assert_equal 5, c.issues.count
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 ic1, ic2, ic3, ic4, ic5 = c.issues.order('subject').to_a
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 assert ic1.root?
assert_equal ic1, ic2.parent
assert_equal ic1, ic3.parent
assert_equal ic2, ic4.parent
assert ic5.root?
end
Jean-Philippe Lang
Adds .rebuild_single_tree! to rebuild a single tree (#24167)....
r15729
def test_rebuild_single_tree
i1 = Issue.generate!
i2 = i1.generate_child!
i3 = i1.generate_child!
Issue.update_all(:lft => 7, :rgt => 7)
Issue.rebuild_single_tree!(i1.id)
i1.reload
assert_equal [1, 6], [i1.lft, i1.rgt]
i2.reload
assert_equal [2, 3], [i2.lft, i2.rgt]
i3.reload
assert_equal [4, 5], [i3.lft, i3.rgt]
other = Issue.find(1)
assert_equal [7, 7], [other.lft, other.rgt]
end
Jean-Philippe Lang
Adds subtasking (#443) including:...
r3459 end