summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-20 11:30:57 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-20 11:30:57 +0000
commit44ac1a0debc802b2ecbaa7cf7f763b373bf0fbb4 (patch)
tree392f95068f7a93f1ddb921dced7bb34815916382 /test/functional
parent1b002983c31f0936b38d56d2f3d8731f724fc5ef (diff)
downloadredmine-44ac1a0debc802b2ecbaa7cf7f763b373bf0fbb4.tar.gz
redmine-44ac1a0debc802b2ecbaa7cf7f763b373bf0fbb4.zip
ProjectsController#add_issue moved to IssuesController#new.
Tracker can now be changed/selected on the new issue form. This action can be invoked without the tracker_id parameter (the first enabled tracker will be used by default). git-svn-id: http://redmine.rubyforge.org/svn/trunk@1080 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/issues_controller_test.rb50
-rw-r--r--test/functional/projects_controller_test.rb19
2 files changed, 50 insertions, 19 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index d60e32200..05bfc96e3 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -29,6 +29,7 @@ class IssuesControllerTest < Test::Unit::TestCase
:issues,
:issue_statuses,
:trackers,
+ :projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
@@ -126,6 +127,55 @@ class IssuesControllerTest < Test::Unit::TestCase
:content => /Notes/ } }
end
+ def test_get_new
+ @request.session[:user_id] = 2
+ get :new, :project_id => 1, :tracker_id => 1
+ assert_response :success
+ assert_template 'new'
+ end
+
+ def test_get_new_without_tracker_id
+ @request.session[:user_id] = 2
+ get :new, :project_id => 1
+ assert_response :success
+ assert_template 'new'
+
+ issue = assigns(:issue)
+ assert_not_nil issue
+ assert_equal Project.find(1).trackers.first, issue.tracker
+ end
+
+ def test_update_new_form
+ @request.session[:user_id] = 2
+ xhr :post, :new, :project_id => 1,
+ :issue => {:tracker_id => 2,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5}
+ assert_response :success
+ assert_template 'new'
+ end
+
+ def test_post_new
+ @request.session[:user_id] = 2
+ post :new, :project_id => 1,
+ :issue => {:tracker_id => 1,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5}
+ assert_redirected_to 'projects/ecookbook/issues'
+ assert Issue.find_by_subject('This is the test_new issue')
+ end
+
+ def test_copy_issue
+ @request.session[:user_id] = 2
+ get :new, :project_id => 1, :copy_from => 1
+ assert_template 'new'
+ assert_not_nil assigns(:issue)
+ orig = Issue.find(1)
+ assert_equal orig.subject, assigns(:issue).subject
+ end
+
def test_get_edit
@request.session[:user_id] = 2
get :edit, :id => 1
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index f19aa7748..61047079e 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -236,23 +236,4 @@ 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/ecookbook/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