From ea307619beceb51d6b9229987480e051f53b67d6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 9 Apr 2012 09:39:27 +0000 Subject: 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 --- test/functional/issues_controller_test.rb | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/functional') 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, -- cgit v1.2.3