diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-10-28 14:31:59 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-10-28 14:31:59 +0000 |
commit | 0af6f347580dd7c331f16aa50904d010fad19e23 (patch) | |
tree | 62abc086a5c11385d04901dba5c0b050a2346034 /test | |
parent | bb4acc02d06d507424057ea41eebe54fdb224b85 (diff) | |
download | redmine-0af6f347580dd7c331f16aa50904d010fad19e23.tar.gz redmine-0af6f347580dd7c331f16aa50904d010fad19e23.zip |
Added the hability to copy an issue.
It can be done from the 'issue/show' view or from the context menu on the issue list.
The Copy functionality is of course only available if the user is allowed to create an issue.
It copies the issue attributes and the custom fields values.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@873 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/projects_controller_test.rb | 21 | ||||
-rw-r--r-- | test/unit/issue_test.rb | 12 |
2 files changed, 31 insertions, 2 deletions
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index b7d7962b6..744cc49d6 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -22,7 +22,7 @@ require 'projects_controller' class ProjectsController; def rescue_action(e) raise e end; end class ProjectsControllerTest < Test::Unit::TestCase - fixtures :projects, :users, :roles, :enabled_modules, :enumerations + fixtures :projects, :users, :roles, :members, :issues, :enabled_modules, :enumerations def setup @controller = ProjectsController.new @@ -143,4 +143,23 @@ class ProjectsControllerTest < Test::Unit::TestCase assert_redirected_to 'admin/projects' assert Project.find(1).active? end + + def test_add_issue + @request.session[:user_id] = 2 + get :add_issue, :id => 1, :tracker_id => 1 + assert_response :success + assert_template 'add_issue' + post :add_issue, :id => 1, :issue => {:tracker_id => 1, :subject => 'This is the test_add_issue issue', :description => 'This is the description', :priority_id => 5} + assert_redirected_to 'projects/list_issues' + assert Issue.find_by_subject('This is the test_add_issue issue') + end + + def test_copy_issue + @request.session[:user_id] = 2 + get :add_issue, :id => 1, :copy_from => 1 + assert_template 'add_issue' + assert_not_nil assigns(:issue) + orig = Issue.find(1) + assert_equal orig.subject, assigns(:issue).subject + end end diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 254bffa20..5ddd4bde4 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -18,13 +18,23 @@ require File.dirname(__FILE__) + '/../test_helper' class IssueTest < Test::Unit::TestCase - fixtures :projects, :users, :members, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues + fixtures :projects, :users, :members, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values def test_category_based_assignment issue = Issue.create(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => Enumeration.get_values('IPRI').first, :subject => 'Assignment test', :description => 'Assignment test', :category_id => 1) assert_equal IssueCategory.find(1).assigned_to, issue.assigned_to end + def test_copy + issue = Issue.new.copy_from(1) + assert issue.save + issue.reload + orig = Issue.find(1) + assert_equal orig.subject, issue.subject + assert_equal orig.tracker, issue.tracker + assert_equal orig.custom_values.first.value, issue.custom_values.first.value + end + def test_close_duplicates # Create 3 issues issue1 = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :priority => Enumeration.get_values('IPRI').first, :subject => 'Duplicates test', :description => 'Duplicates test') |