Refactor: extract #bulk_update method from IssuesController#bulk_edit.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4037 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2010-08-24 15:27:12 +00:00
parent 95673a9ee4
commit 80256cf298
6 changed files with 46 additions and 39 deletions
+16 -16
View File
@@ -910,10 +910,10 @@ class IssuesControllerTest < ActionController::TestCase
assert_tag :select, :attributes => {:name => 'issue[custom_field_values][1]'}
end
def test_bulk_edit
def test_bulk_update
@request.session[:user_id] = 2
# update issues priority
post :bulk_edit, :ids => [1, 2], :notes => 'Bulk editing',
post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing',
:issue => {:priority_id => 7,
:assigned_to_id => '',
:custom_field_values => {'2' => ''}}
@@ -929,10 +929,10 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 1, journal.details.size
end
def test_bullk_edit_should_send_a_notification
def test_bullk_update_should_send_a_notification
@request.session[:user_id] = 2
ActionMailer::Base.deliveries.clear
post(:bulk_edit,
post(:bulk_update,
{
:ids => [1, 2],
:notes => 'Bulk editing',
@@ -947,10 +947,10 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_bulk_edit_status
def test_bulk_update_status
@request.session[:user_id] = 2
# update issues priority
post :bulk_edit, :ids => [1, 2], :notes => 'Bulk editing status',
post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing status',
:issue => {:priority_id => '',
:assigned_to_id => '',
:status_id => '5'}
@@ -960,10 +960,10 @@ class IssuesControllerTest < ActionController::TestCase
assert issue.closed?
end
def test_bulk_edit_custom_field
def test_bulk_update_custom_field
@request.session[:user_id] = 2
# update issues priority
post :bulk_edit, :ids => [1, 2], :notes => 'Bulk editing custom field',
post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing custom field',
:issue => {:priority_id => '',
:assigned_to_id => '',
:custom_field_values => {'2' => '777'}}
@@ -978,20 +978,20 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal '777', journal.details.first.value
end
def test_bulk_unassign
def test_bulk_update_unassign
assert_not_nil Issue.find(2).assigned_to
@request.session[:user_id] = 2
# unassign issues
post :bulk_edit, :ids => [1, 2], :notes => 'Bulk unassigning', :issue => {:assigned_to_id => 'none'}
post :bulk_update, :ids => [1, 2], :notes => 'Bulk unassigning', :issue => {:assigned_to_id => 'none'}
assert_response 302
# check that the issues were updated
assert_nil Issue.find(2).assigned_to
end
def test_post_bulk_edit_should_allow_fixed_version_to_be_set_to_a_subproject
def test_post_bulk_update_should_allow_fixed_version_to_be_set_to_a_subproject
@request.session[:user_id] = 2
post :bulk_edit, :ids => [1,2], :issue => {:fixed_version_id => 4}
post :bulk_update, :ids => [1,2], :issue => {:fixed_version_id => 4}
assert_response :redirect
issues = Issue.find([1,2])
@@ -1001,17 +1001,17 @@ class IssuesControllerTest < ActionController::TestCase
end
end
def test_post_bulk_edit_should_redirect_back_using_the_back_url_parameter
def test_post_bulk_update_should_redirect_back_using_the_back_url_parameter
@request.session[:user_id] = 2
post :bulk_edit, :ids => [1,2], :back_url => '/issues'
post :bulk_update, :ids => [1,2], :back_url => '/issues'
assert_response :redirect
assert_redirected_to '/issues'
end
def test_post_bulk_edit_should_not_redirect_back_using_the_back_url_parameter_off_the_host
def test_post_bulk_update_should_not_redirect_back_using_the_back_url_parameter_off_the_host
@request.session[:user_id] = 2
post :bulk_edit, :ids => [1,2], :back_url => 'http://google.com'
post :bulk_update, :ids => [1,2], :back_url => 'http://google.com'
assert_response :redirect
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => Project.find(1).identifier