summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-29 19:46:40 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-29 19:46:40 +0000
commit88fcf484d4d3c8d591cc31d7d07790110161d923 (patch)
treee34f2c0054384cf22c1527cdf9c3e1771ad1b2bf /test
parent3d317a435bb435b2ec8d2c6bc6ef3791dfcc080b (diff)
downloadredmine-88fcf484d4d3c8d591cc31d7d07790110161d923.tar.gz
redmine-88fcf484d4d3c8d591cc31d7d07790110161d923.zip
Enable tracker update on issue edit form (#2405).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3108 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb31
-rw-r--r--test/unit/issue_test.rb23
2 files changed, 51 insertions, 3 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 9555db4ea..4c6b25358 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -501,14 +501,20 @@ class IssuesControllerTest < ActionController::TestCase
def test_update_new_form
@request.session[:user_id] = 2
- xhr :post, :new, :project_id => 1,
+ xhr :post, :update_form, :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
+ assert_template 'attributes'
+
+ issue = assigns(:issue)
+ assert_kind_of Issue, issue
+ assert_equal 1, issue.project_id
+ assert_equal 2, issue.tracker_id
+ assert_equal 'This is the test_new issue', issue.subject
+ end
def test_post_new
@request.session[:user_id] = 2
@@ -698,6 +704,25 @@ class IssuesControllerTest < ActionController::TestCase
:content => 'Urgent',
:attributes => { :selected => 'selected' } }
end
+
+ def test_update_edit_form
+ @request.session[:user_id] = 2
+ xhr :post, :update_form, :project_id => 1,
+ :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 'attributes'
+
+ issue = assigns(:issue)
+ assert_kind_of Issue, issue
+ assert_equal 1, issue.id
+ assert_equal 1, issue.project_id
+ assert_equal 2, issue.tracker_id
+ assert_equal 'This is the test_new issue', issue.subject
+ end
def test_reply_routing
assert_routing(
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 3b0dd2697..afde6c720 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -164,6 +164,29 @@ class IssueTest < ActiveSupport::TestCase
assert_equal custom_value.id, issue.custom_value_for(field).id
end
+ def test_should_update_issue_with_disabled_tracker
+ p = Project.find(1)
+ issue = Issue.find(1)
+
+ p.trackers.delete(issue.tracker)
+ assert !p.trackers.include?(issue.tracker)
+
+ issue.reload
+ issue.subject = 'New subject'
+ assert issue.save
+ end
+
+ def test_should_not_set_a_disabled_tracker
+ p = Project.find(1)
+ p.trackers.delete(Tracker.find(2))
+
+ issue = Issue.find(1)
+ issue.tracker_id = 2
+ issue.subject = 'New subject'
+ assert !issue.save
+ assert_not_nil issue.errors.on(:tracker_id)
+ end
+
def test_category_based_assignment
issue = Issue.create(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => IssuePriority.all.first, :subject => 'Assignment test', :description => 'Assignment test', :category_id => 1)
assert_equal IssueCategory.find(1).assigned_to, issue.assigned_to