summaryrefslogtreecommitdiffstats
path: root/test/functional/repositories_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-05 10:56:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-05 10:56:27 +0000
commit1d4ef8964def4ecbe7a11485f72d7fbe61c55724 (patch)
tree4986d5f51daebd1ff66ac58cdf56042624e2edc3 /test/functional/repositories_controller_test.rb
parentc4ea429acbc09205155509e9c41e111294bc8f82 (diff)
downloadredmine-1d4ef8964def4ecbe7a11485f72d7fbe61c55724.tar.gz
redmine-1d4ef8964def4ecbe7a11485f72d7fbe61c55724.zip
Adds a "Manage related isses" permission to add/remove commits/issues relations manually from the changeset view (#2009).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8777 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/repositories_controller_test.rb')
-rw-r--r--test/functional/repositories_controller_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index 6bcbb6beb..844e8fa87 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -160,6 +160,38 @@ class RepositoriesControllerTest < ActionController::TestCase
}
end
+ def test_add_related_issue
+ @request.session[:user_id] = 2
+ assert_difference 'Changeset.find(103).issues.size' do
+ post :add_related_issue, :id => 1, :rev => 4, :issue_id => 2
+ assert_response :success
+ end
+ assert_select_rjs :replace_html, 'related-issues'
+ assert_equal [2], Changeset.find(103).issue_ids
+ end
+
+ def test_add_related_issue_with_invalid_issue_id
+ @request.session[:user_id] = 2
+ assert_no_difference 'Changeset.find(103).issues.size' do
+ post :add_related_issue, :id => 1, :rev => 4, :issue_id => 9999
+ assert_response :success
+ end
+ assert_include 'alert("Issue is invalid")', @response.body
+ end
+
+ def test_remove_related_issue
+ Changeset.find(103).issues << Issue.find(1)
+ Changeset.find(103).issues << Issue.find(2)
+
+ @request.session[:user_id] = 2
+ assert_difference 'Changeset.find(103).issues.size', -1 do
+ delete :remove_related_issue, :id => 1, :rev => 4, :issue_id => 2
+ assert_response :success
+ end
+ assert_select_rjs :remove, 'related-issue-2'
+ assert_equal [1], Changeset.find(103).issue_ids
+ end
+
def test_graph_commits_per_month
get :graph, :id => 1, :graph => 'commits_per_month'
assert_response :success