##// END OF EJS Templates
Fixed an error when trying to copy an issue that does not exist....
Jean-Philippe Lang -
r8550:b4cf4fca9d5b
parent child
Show More
@@ -360,7 +360,12 private
360 def build_new_issue_from_params
360 def build_new_issue_from_params
361 if params[:id].blank?
361 if params[:id].blank?
362 @issue = Issue.new
362 @issue = Issue.new
363 @issue.copy_from(params[:copy_from]) if params[:copy_from]
363 begin
364 @issue.copy_from(params[:copy_from]) if params[:copy_from]
365 rescue ActiveRecord::RecordNotFound
366 render_404
367 return
368 end
364 @issue.project = @project
369 @issue.project = @project
365 else
370 else
366 @issue = @project.issues.visible.find(params[:id])
371 @issue = @project.issues.visible.find(params[:id])
@@ -1631,6 +1631,12 class IssuesControllerTest < ActionController::TestCase
1631 assert_tag 'input', :attributes => {:name => 'copy_from', :value => '1'}
1631 assert_tag 'input', :attributes => {:name => 'copy_from', :value => '1'}
1632 end
1632 end
1633
1633
1634 def test_new_as_copy_with_invalid_issue_should_respond_with_404
1635 @request.session[:user_id] = 2
1636 get :new, :project_id => 1, :copy_from => 99999
1637 assert_response 404
1638 end
1639
1634 def test_create_as_copy_on_different_project
1640 def test_create_as_copy_on_different_project
1635 @request.session[:user_id] = 2
1641 @request.session[:user_id] = 2
1636 assert_difference 'Issue.count' do
1642 assert_difference 'Issue.count' do
General Comments 0
You need to be logged in to leave comments. Login now