summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-07 16:18:53 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-07 16:18:53 +0000
commitd29638845a9c5d69f9ad6e9ab8c81ed29c808c3f (patch)
tree4fd7f84ee7eb5c3e1bc124ad7193812f24094013 /test
parentdc8fcbaf036981fa08899f8de46afb8a18e4612a (diff)
downloadredmine-d29638845a9c5d69f9ad6e9ab8c81ed29c808c3f.tar.gz
redmine-d29638845a9c5d69f9ad6e9ab8c81ed29c808c3f.zip
Allows project to be changed from the bulk edit form.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8536 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb51
-rw-r--r--test/integration/routing/issues_test.rb5
2 files changed, 56 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 435ff82f0..234cb41f8 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -2033,6 +2033,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'bulk_edit'
+ assert_tag :select, :attributes => {:name => 'issue[project_id]'}
assert_tag :input, :attributes => {:name => 'issue[parent_issue_id]'}
# Project specific custom field, date type
@@ -2185,6 +2186,38 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 2, ActionMailer::Base.deliveries.size
end
+ def test_bulk_update_project
+ @request.session[:user_id] = 2
+ post :bulk_update, :ids => [1, 2], :issue => {:project_id => '2'}
+ assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
+ # Issues moved to project 2
+ assert_equal 2, Issue.find(1).project_id
+ assert_equal 2, Issue.find(2).project_id
+ # No tracker change
+ assert_equal 1, Issue.find(1).tracker_id
+ assert_equal 2, Issue.find(2).tracker_id
+ end
+
+ def test_bulk_update_project_on_single_issue_should_follow_when_needed
+ @request.session[:user_id] = 2
+ post :bulk_update, :id => 1, :issue => {:project_id => '2'}, :follow => '1'
+ assert_redirected_to '/issues/1'
+ end
+
+ def test_bulk_update_project_on_multiple_issues_should_follow_when_needed
+ @request.session[:user_id] = 2
+ post :bulk_update, :id => [1, 2], :issue => {:project_id => '2'}, :follow => '1'
+ assert_redirected_to '/projects/onlinestore/issues'
+ end
+
+ def test_bulk_update_tracker
+ @request.session[:user_id] = 2
+ post :bulk_update, :ids => [1, 2], :issue => {:tracker_id => '2'}
+ assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
+ assert_equal 2, Issue.find(1).tracker_id
+ assert_equal 2, Issue.find(2).tracker_id
+ end
+
def test_bulk_update_status
@request.session[:user_id] = 2
# update issues priority
@@ -2198,6 +2231,24 @@ class IssuesControllerTest < ActionController::TestCase
assert issue.closed?
end
+ def test_bulk_update_priority
+ @request.session[:user_id] = 2
+ post :bulk_update, :ids => [1, 2], :issue => {:priority_id => 6}
+
+ assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
+ assert_equal 6, Issue.find(1).priority_id
+ assert_equal 6, Issue.find(2).priority_id
+ end
+
+ def test_bulk_update_with_notes
+ @request.session[:user_id] = 2
+ post :bulk_update, :ids => [1, 2], :notes => 'Moving two issues'
+
+ assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
+ assert_equal 'Moving two issues', Issue.find(1).journals.sort_by(&:id).last.notes
+ assert_equal 'Moving two issues', Issue.find(2).journals.sort_by(&:id).last.notes
+ end
+
def test_bulk_update_parent_id
@request.session[:user_id] = 2
post :bulk_update, :ids => [1, 3],
diff --git a/test/integration/routing/issues_test.rb b/test/integration/routing/issues_test.rb
index b15c83d3f..cb727b7ac 100644
--- a/test/integration/routing/issues_test.rb
+++ b/test/integration/routing/issues_test.rb
@@ -123,6 +123,11 @@ class RoutingIssuesTest < ActionController::IntegrationTest
{ :method => 'get', :path => "/issues/bulk_edit" },
{ :controller => 'issues', :action => 'bulk_edit' }
)
+ # For updating the bulk edit form
+ assert_routing(
+ { :method => 'post', :path => "/issues/bulk_edit" },
+ { :controller => 'issues', :action => 'bulk_edit' }
+ )
assert_routing(
{ :method => 'post', :path => "/issues/bulk_update" },
{ :controller => 'issues', :action => 'bulk_update' }