mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 11:25:55 +01:00
Added ability to edit issues from different project through contextual menu (#5332)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4242 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -911,6 +911,19 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
assert_tag :select, :attributes => {:name => 'issue[custom_field_values][1]'}
|
||||
end
|
||||
|
||||
def test_get_bulk_edit_on_different_projects
|
||||
@request.session[:user_id] = 2
|
||||
get :bulk_edit, :ids => [1, 2, 6]
|
||||
assert_response :success
|
||||
assert_template 'bulk_edit'
|
||||
|
||||
# Project specific custom field, date type
|
||||
field = CustomField.find(9)
|
||||
assert !field.is_for_all?
|
||||
assert !field.project_ids.include?(Issue.find(6).project_id)
|
||||
assert_no_tag :input, :attributes => {:name => 'issue[custom_field_values][9]'}
|
||||
end
|
||||
|
||||
def test_bulk_update
|
||||
@request.session[:user_id] = 2
|
||||
# update issues priority
|
||||
@@ -930,6 +943,39 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
assert_equal 1, journal.details.size
|
||||
end
|
||||
|
||||
def test_bulk_update_on_different_projects
|
||||
@request.session[:user_id] = 2
|
||||
# update issues priority
|
||||
post :bulk_update, :ids => [1, 2, 6], :notes => 'Bulk editing',
|
||||
:issue => {:priority_id => 7,
|
||||
:assigned_to_id => '',
|
||||
:custom_field_values => {'2' => ''}}
|
||||
|
||||
assert_response 302
|
||||
# check that the issues were updated
|
||||
assert_equal [7, 7, 7], Issue.find([1,2,6]).map(&:priority_id)
|
||||
|
||||
issue = Issue.find(1)
|
||||
journal = issue.journals.find(:first, :order => 'created_on DESC')
|
||||
assert_equal '125', issue.custom_value_for(2).value
|
||||
assert_equal 'Bulk editing', journal.notes
|
||||
assert_equal 1, journal.details.size
|
||||
end
|
||||
|
||||
def test_bulk_update_on_different_projects_without_rights
|
||||
@request.session[:user_id] = 3
|
||||
user = User.find(3)
|
||||
action = { :controller => "issues", :action => "bulk_update" }
|
||||
assert user.allowed_to?(action, Issue.find(1).project)
|
||||
assert ! user.allowed_to?(action, Issue.find(6).project)
|
||||
post :bulk_update, :ids => [1, 6], :notes => 'Bulk should fail',
|
||||
:issue => {:priority_id => 7,
|
||||
:assigned_to_id => '',
|
||||
:custom_field_values => {'2' => ''}}
|
||||
assert_response 403
|
||||
assert_not_equal "Bulk should fail", Journal.last.notes
|
||||
end
|
||||
|
||||
def test_bullk_update_should_send_a_notification
|
||||
@request.session[:user_id] = 2
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
Reference in New Issue
Block a user