summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-07 12:34:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-07 12:34:52 +0000
commit81cf6b23439705231e1b3655709b3d3cae43a9cd (patch)
treea5df6e34e896adba499bd536c2d3fa3e1973d752 /test/functional
parent3dd97a87c6707eb53410814a9594b6eebbc130ec (diff)
downloadredmine-81cf6b23439705231e1b3655709b3d3cae43a9cd.tar.gz
redmine-81cf6b23439705231e1b3655709b3d3cae43a9cd.zip
Allows project to be changed from the regular issue update action (#4769, #9803).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8531 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/issues_controller_test.rb79
1 files changed, 78 insertions, 1 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index e76de084d..435ff82f0 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -721,6 +721,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_tag 'form', :attributes => {:id => 'issue-form'}
assert_tag 'input', :attributes => {:name => 'issue[is_private]'}
+ assert_tag 'select', :attributes => {:name => 'issue[project_id]'}
assert_tag 'select', :attributes => {:name => 'issue[tracker_id]'}
assert_tag 'input', :attributes => {:name => 'issue[subject]'}
assert_tag 'textarea', :attributes => {:name => 'issue[description]'}
@@ -748,6 +749,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_tag 'form', :attributes => {:id => 'issue-form'}
assert_no_tag 'input', :attributes => {:name => 'issue[is_private]'}
+ assert_no_tag 'select', :attributes => {:name => 'issue[project_id]'}
assert_no_tag 'select', :attributes => {:name => 'issue[tracker_id]'}
assert_no_tag 'input', :attributes => {:name => 'issue[subject]'}
assert_no_tag 'textarea', :attributes => {:name => 'issue[description]'}
@@ -774,6 +776,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_tag 'form', :attributes => {:id => 'issue-form'}
assert_no_tag 'input', :attributes => {:name => 'issue[is_private]'}
+ assert_no_tag 'select', :attributes => {:name => 'issue[project_id]'}
assert_no_tag 'select', :attributes => {:name => 'issue[tracker_id]'}
assert_no_tag 'input', :attributes => {:name => 'issue[subject]'}
assert_no_tag 'textarea', :attributes => {:name => 'issue[description]'}
@@ -1014,6 +1017,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_template 'new'
assert_tag 'input', :attributes => {:name => 'issue[is_private]'}
+ assert_no_tag 'select', :attributes => {:name => 'issue[project_id]'}
assert_tag 'select', :attributes => {:name => 'issue[tracker_id]'}
assert_tag 'input', :attributes => {:name => 'issue[subject]'}
assert_tag 'textarea', :attributes => {:name => 'issue[description]'}
@@ -1045,6 +1049,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_template 'new'
assert_no_tag 'input', :attributes => {:name => 'issue[is_private]'}
+ assert_no_tag 'select', :attributes => {:name => 'issue[project_id]'}
assert_tag 'select', :attributes => {:name => 'issue[tracker_id]'}
assert_tag 'input', :attributes => {:name => 'issue[subject]'}
assert_tag 'textarea', :attributes => {:name => 'issue[description]'}
@@ -1636,7 +1641,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_update_edit_form
@request.session[:user_id] = 2
- xhr :post, :new, :project_id => 1,
+ xhr :put, :new, :project_id => 1,
:id => 1,
:issue => {:tracker_id => 2,
:subject => 'This is the test_new issue',
@@ -1653,6 +1658,27 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'This is the test_new issue', issue.subject
end
+ def test_update_edit_form_with_project_change
+ @request.session[:user_id] = 2
+ xhr :put, :new, :project_id => 1,
+ :id => 1,
+ :project_change => '1',
+ :issue => {:project_id => 2,
+ :tracker_id => 2,
+ :subject => 'This is the test_new issue',
+ :description => 'This is the description',
+ :priority_id => 5}
+ assert_response :success
+ assert_template 'form'
+
+ issue = assigns(:issue)
+ assert_kind_of Issue, issue
+ assert_equal 1, issue.id
+ assert_equal 2, issue.project_id
+ assert_equal 2, issue.tracker_id
+ assert_equal 'This is the test_new issue', issue.subject
+ end
+
def test_update_using_invalid_http_verbs
@request.session[:user_id] = 2
subject = 'Updated by an invalid http verb'
@@ -1696,6 +1722,57 @@ class IssuesControllerTest < ActionController::TestCase
assert mail.body.include?("Subject changed from #{old_subject} to #{new_subject}")
end
+ def test_put_update_with_project_change
+ @request.session[:user_id] = 2
+ ActionMailer::Base.deliveries.clear
+
+ assert_difference('Journal.count') do
+ assert_difference('JournalDetail.count', 3) do
+ put :update, :id => 1, :issue => {:project_id => '2',
+ :tracker_id => '1', # no change
+ :priority_id => '6',
+ :category_id => '3'
+ }
+ end
+ end
+ assert_redirected_to :action => 'show', :id => '1'
+ issue = Issue.find(1)
+ assert_equal 2, issue.project_id
+ assert_equal 1, issue.tracker_id
+ assert_equal 6, issue.priority_id
+ assert_equal 3, issue.category_id
+
+ mail = ActionMailer::Base.deliveries.last
+ assert_not_nil mail
+ assert mail.subject.starts_with?("[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}]")
+ assert mail.body.include?("Project changed from eCookbook to OnlineStore")
+ end
+
+ def test_put_update_with_tracker_change
+ @request.session[:user_id] = 2
+ ActionMailer::Base.deliveries.clear
+
+ assert_difference('Journal.count') do
+ assert_difference('JournalDetail.count', 2) do
+ put :update, :id => 1, :issue => {:project_id => '1',
+ :tracker_id => '2',
+ :priority_id => '6'
+ }
+ end
+ end
+ assert_redirected_to :action => 'show', :id => '1'
+ issue = Issue.find(1)
+ assert_equal 1, issue.project_id
+ assert_equal 2, issue.tracker_id
+ assert_equal 6, issue.priority_id
+ assert_equal 1, issue.category_id
+
+ mail = ActionMailer::Base.deliveries.last
+ assert_not_nil mail
+ assert mail.subject.starts_with?("[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}]")
+ assert mail.body.include?("Tracker changed from Bug to Feature request")
+ end
+
def test_put_update_with_custom_field_change
@request.session[:user_id] = 2
issue = Issue.find(1)