diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-09-08 05:56:48 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-09-08 05:56:48 +0000 |
commit | 6a37151b5cd0086b53b6c9fd336ff143c4defd42 (patch) | |
tree | a9721d4a803dec3a44d564a06b25d821aef6c77f /test/unit/project_test.rb | |
parent | 5003927f13f54850ca9eeac48e353df5e4e325a1 (diff) | |
download | redmine-6a37151b5cd0086b53b6c9fd336ff143c4defd42.tar.gz redmine-6a37151b5cd0086b53b6c9fd336ff143c4defd42.zip |
Adapt subtasks copy when copying a project (#6965).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10328 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r-- | test/unit/project_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index 3abfbe327..1171c5e93 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -1018,7 +1018,23 @@ class ProjectTest < ActiveSupport::TestCase assert @project.issue_categories.any? assert @project.issues.empty? end + end + + def test_copy_should_copy_subtasks + source = Project.generate!(:tracker_ids => [1]) + issue = Issue.generate_with_descendants!(source, :subject => 'Parent') + project = Project.new(:name => 'Copy', :identifier => 'copy', :tracker_ids => [1]) + assert_difference 'Project.count' do + assert_difference 'Issue.count', 1+issue.descendants.count do + assert project.copy(source.reload) + end + end + copy = Issue.where(:parent_id => nil).order("id DESC").first + assert_equal project, copy.project + assert_equal issue.descendants.count, copy.descendants.count + child_copy = copy.children.detect {|c| c.subject == 'Child1'} + assert child_copy.descendants.any? end context "#start_date" do |