# admin is allowed to move issues to any active (visible) project
@allowed_projects = Project.find(:all, :conditions => Project.visible_by(User.current))
else
- User.current.memberships.each {|m| @allowed_projects << m.project if m.role.allowed_to?(:move_issues)}
+ User.current.memberships.each {|m| @allowed_projects << m.project if m.roles.detect {|r| r.allowed_to?(:move_issues)}}
end
@target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
@target_project ||= @project
end
def test_move_one_issue_to_another_project
- @request.session[:user_id] = 1
+ @request.session[:user_id] = 2
post :move, :id => 1, :new_project_id => 2
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
assert_equal 2, Issue.find(1).project_id
end
def test_bulk_move_to_another_project
- @request.session[:user_id] = 1
+ @request.session[:user_id] = 2
post :move, :ids => [1, 2], :new_project_id => 2
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
# Issues moved to project 2
end
def test_bulk_move_to_another_tracker
- @request.session[:user_id] = 1
+ @request.session[:user_id] = 2
post :move, :ids => [1, 2], :new_tracker_id => 2
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
assert_equal 2, Issue.find(1).tracker_id
end
def test_bulk_copy_to_another_project
- @request.session[:user_id] = 1
+ @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'}