@@ -773,7 +773,7 class Project < ActiveRecord::Base | |||||
773 | # get copied before their children |
|
773 | # get copied before their children | |
774 | project.issues.find(:all, :order => 'root_id, lft').each do |issue| |
|
774 | project.issues.find(:all, :order => 'root_id, lft').each do |issue| | |
775 | new_issue = Issue.new |
|
775 | new_issue = Issue.new | |
776 | new_issue.copy_from(issue) |
|
776 | new_issue.copy_from(issue, :subtasks => false) | |
777 | new_issue.project = self |
|
777 | new_issue.project = self | |
778 | # Reassign fixed_versions by name, since names are unique per |
|
778 | # Reassign fixed_versions by name, since names are unique per | |
779 | # project and the versions for self are not yet saved |
|
779 | # project and the versions for self are not yet saved |
@@ -1018,7 +1018,23 class ProjectTest < ActiveSupport::TestCase | |||||
1018 | assert @project.issue_categories.any? |
|
1018 | assert @project.issue_categories.any? | |
1019 | assert @project.issues.empty? |
|
1019 | assert @project.issues.empty? | |
1020 | end |
|
1020 | end | |
|
1021 | end | |||
|
1022 | ||||
|
1023 | def test_copy_should_copy_subtasks | |||
|
1024 | source = Project.generate!(:tracker_ids => [1]) | |||
|
1025 | issue = Issue.generate_with_descendants!(source, :subject => 'Parent') | |||
|
1026 | project = Project.new(:name => 'Copy', :identifier => 'copy', :tracker_ids => [1]) | |||
1021 |
|
1027 | |||
|
1028 | assert_difference 'Project.count' do | |||
|
1029 | assert_difference 'Issue.count', 1+issue.descendants.count do | |||
|
1030 | assert project.copy(source.reload) | |||
|
1031 | end | |||
|
1032 | end | |||
|
1033 | copy = Issue.where(:parent_id => nil).order("id DESC").first | |||
|
1034 | assert_equal project, copy.project | |||
|
1035 | assert_equal issue.descendants.count, copy.descendants.count | |||
|
1036 | child_copy = copy.children.detect {|c| c.subject == 'Child1'} | |||
|
1037 | assert child_copy.descendants.any? | |||
1022 | end |
|
1038 | end | |
1023 |
|
1039 | |||
1024 | context "#start_date" do |
|
1040 | context "#start_date" do |
General Comments 0
You need to be logged in to leave comments.
Login now