summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-12-04 22:46:12 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-12-04 22:46:12 +0000
commite1781235696fe23851154ebbdc913e970d3c0f3a (patch)
tree4e8521c7522d590fc7579e0fa3b5e97d91402092 /test
parentc870a7b9ef35ed457911638b7a98e7681cfe6d3a (diff)
downloadredmine-e1781235696fe23851154ebbdc913e970d3c0f3a.tar.gz
redmine-e1781235696fe23851154ebbdc913e970d3c0f3a.zip
Enhanced the Issue Bulk Copy feature:
* Add a Copy option to the Context menu for multiple issues. * Added assigned to, status, start and due date options to the move/copy form. * Allow Issue#move_to to change attributes on the moved/copied issue. #4117 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3122 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb24
-rw-r--r--test/unit/issue_test.rb32
2 files changed, 56 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 93e29957e..8ebf6c022 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -1059,6 +1059,27 @@ class IssuesControllerTest < ActionController::TestCase
assert_redirected_to 'projects/ecookbook/issues'
end
+ context "#move via bulk copy" do
+ should "allow changing the issue's attributes" do
+ @request.session[:user_id] = 2
+ 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'}, :assigned_to_id => 4, :status_id => 3, :start_date => '2009-12-01', :due_date => '2009-12-31'
+ end
+ end
+
+ copied_issues = Issue.all(:limit => 2, :order => 'id desc', :conditions => {:project_id => 2})
+ assert_equal 2, copied_issues.size
+ copied_issues.each do |issue|
+ assert_equal 2, issue.project_id, "Project is incorrect"
+ assert_equal 4, issue.assigned_to_id, "Assigned to is incorrect"
+ assert_equal 3, issue.status_id, "Status is incorrect"
+ assert_equal '2009-12-01', issue.start_date.to_s, "Start date is incorrect"
+ assert_equal '2009-12-31', issue.due_date.to_s, "Due date is incorrect"
+ end
+ end
+ end
+
def test_copy_to_another_project_should_follow_when_needed
@request.session[:user_id] = 2
post :move, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1'
@@ -1117,6 +1138,9 @@ class IssuesControllerTest < ActionController::TestCase
assert_tag :tag => 'a', :content => 'Dave Lopper',
:attributes => { :href => '/issues/bulk_edit?assigned_to_id=3&amp;ids%5B%5D=1&amp;ids%5B%5D=2',
:class => '' }
+ assert_tag :tag => 'a', :content => 'Copy',
+ :attributes => { :href => '/issues/move?copy_options%5Bcopy%5D=t&amp;ids%5B%5D=1&amp;ids%5B%5D=2',
+ :class => 'icon-copy' }
assert_tag :tag => 'a', :content => 'Move',
:attributes => { :href => '/issues/move?ids%5B%5D=1&amp;ids%5B%5D=2',
:class => 'icon-move' }
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index bd37f9880..6213524b8 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -352,6 +352,38 @@ class IssueTest < ActiveSupport::TestCase
# Custom field #2 is not associated with target tracker
assert_nil copy.custom_value_for(2)
end
+
+ context "#move_to" do
+ context "as a copy" do
+ setup do
+ @issue = Issue.find(1)
+ @copy = nil
+ end
+
+ should "allow assigned_to changes" do
+ @copy = @issue.move_to(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:assigned_to_id => 3}})
+ assert_equal 3, @copy.assigned_to_id
+ end
+
+ should "allow status changes" do
+ @copy = @issue.move_to(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:status_id => 2}})
+ assert_equal 2, @copy.status_id
+ end
+
+ should "allow start date changes" do
+ date = Date.today
+ @copy = @issue.move_to(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:start_date => date}})
+ assert_equal date, @copy.start_date
+ end
+
+ should "allow due date changes" do
+ date = Date.today
+ @copy = @issue.move_to(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:due_date => date}})
+
+ assert_equal date, @copy.due_date
+ end
+ end
+ end
def test_recipients_should_not_include_users_that_cannot_view_the_issue
issue = Issue.find(12)