summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-09 09:39:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-09 09:39:27 +0000
commitea307619beceb51d6b9229987480e051f53b67d6 (patch)
treec207f141fbcb94e6bdd5449e3806afe0f322dfde /test/functional
parent6d62ab64e6aa2eda3a7da481779821281bde16d9 (diff)
downloadredmine-ea307619beceb51d6b9229987480e051f53b67d6.tar.gz
redmine-ea307619beceb51d6b9229987480e051f53b67d6.zip
Fixed that improper statuses are proposed when changing status before tracker on the issue form (#10619).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9378 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/issues_controller_test.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 217d6e68f..9bb600eff 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -1363,6 +1363,22 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'This is the test_new issue', issue.subject
end
+ def test_update_new_form_should_propose_transitions_based_on_initial_status
+ @request.session[:user_id] = 2
+ Workflow.delete_all
+ Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2)
+ Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 5)
+ Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4)
+
+ xhr :post, :new, :project_id => 1,
+ :issue => {:tracker_id => 1,
+ :status_id => 5,
+ :subject => 'This is an issue'}
+
+ assert_equal 5, assigns(:issue).status_id
+ assert_equal [1,2,5], assigns(:allowed_statuses).map(&:id).sort
+ end
+
def test_post_create
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
@@ -2171,6 +2187,23 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'This is the test_new issue', issue.subject
end
+ def test_update_edit_form_should_propose_transitions_based_on_initial_status
+ @request.session[:user_id] = 2
+ Workflow.delete_all
+ Workflow.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 1)
+ Workflow.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 5)
+ Workflow.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 5, :new_status_id => 4)
+
+ xhr :put, :new, :project_id => 1,
+ :id => 2,
+ :issue => {:tracker_id => 2,
+ :status_id => 5,
+ :subject => 'This is an issue'}
+
+ assert_equal 5, assigns(:issue).status_id
+ assert_equal [1,2,5], assigns(:allowed_statuses).map(&:id).sort
+ end
+
def test_update_edit_form_with_project_change
@request.session[:user_id] = 2
xhr :put, :new, :project_id => 1,