summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-25 13:12:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-25 13:12:56 +0000
commit1ad255155949930d2a7bdf667b415939fd71e16d (patch)
tree6cc4801f6379e3e5e7f178e417d158f410c3a9ac /test
parent41f3bae9170c5231a85c1b85b1596fba8e2f6d77 (diff)
downloadredmine-1ad255155949930d2a7bdf667b415939fd71e16d.tar.gz
redmine-1ad255155949930d2a7bdf667b415939fd71e16d.zip
Adds ability to bulk copy issues (#1847).
This can be done by checking the 'Copy' checkbox on the 'Move' form. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2313 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb10
-rw-r--r--test/unit/issue_test.rb24
2 files changed, 34 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 093797e38..b3978c39c 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -672,6 +672,16 @@ class IssuesControllerTest < Test::Unit::TestCase
assert_equal 2, Issue.find(1).tracker_id
assert_equal 2, Issue.find(2).tracker_id
end
+
+ def test_bulk_copy_to_another_project
+ @request.session[:user_id] = 1
+ assert_difference 'Issue.count', 2 do
+ assert_no_difference 'Project.find(1).issues.count' do
+ post :move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'}
+ end
+ end
+ assert_redirected_to 'projects/ecookbook/issues'
+ end
def test_context_menu_one_issue
@request.session[:user_id] = 2
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index ed7593a30..b82303264 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -191,6 +191,30 @@ class IssueTest < Test::Unit::TestCase
assert_nil issue.category_id
end
+ def test_copy_to_the_same_project
+ issue = Issue.find(1)
+ copy = nil
+ assert_difference 'Issue.count' do
+ copy = issue.move_to(issue.project, nil, :copy => true)
+ end
+ assert_kind_of Issue, copy
+ assert_equal issue.project, copy.project
+ assert_equal "125", copy.custom_value_for(2).value
+ end
+
+ def test_copy_to_another_project_and_tracker
+ issue = Issue.find(1)
+ copy = nil
+ assert_difference 'Issue.count' do
+ copy = issue.move_to(Project.find(3), Tracker.find(2), :copy => true)
+ end
+ assert_kind_of Issue, copy
+ assert_equal Project.find(3), copy.project
+ assert_equal Tracker.find(2), copy.tracker
+ # Custom field #2 is not associated with target tracker
+ assert_nil copy.custom_value_for(2)
+ end
+
def test_issue_destroy
Issue.find(1).destroy
assert_nil Issue.find_by_id(1)