summaryrefslogtreecommitdiffstats
path: root/test/functional/issue_relations_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-19 17:06:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-19 17:06:30 +0000
commit85531070161564e6a99bdf518e17486482fa1bdb (patch)
tree3a2793dce2b0ea0463bd4a12773c7015479480e1 /test/functional/issue_relations_controller_test.rb
parent21ee2e2cf246550436b22d5d32698d87839cad6c (diff)
downloadredmine-85531070161564e6a99bdf518e17486482fa1bdb.tar.gz
redmine-85531070161564e6a99bdf518e17486482fa1bdb.zip
Removes RJS from IssueRelationsController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10045 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/issue_relations_controller_test.rb')
-rw-r--r--test/functional/issue_relations_controller_test.rb32
1 files changed, 24 insertions, 8 deletions
diff --git a/test/functional/issue_relations_controller_test.rb b/test/functional/issue_relations_controller_test.rb
index 2a265e369..b629808bb 100644
--- a/test/functional/issue_relations_controller_test.rb
+++ b/test/functional/issue_relations_controller_test.rb
@@ -57,17 +57,16 @@ class IssueRelationsControllerTest < ActionController::TestCase
def test_create_xhr
assert_difference 'IssueRelation.count' do
@request.session[:user_id] = 3
- xhr :post, :create,
- :issue_id => 3,
- :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
- assert_select_rjs 'relations' do
- assert_select 'table', 1
- assert_select 'tr', 2 # relations
- end
+ xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
+ assert_response :success
+ assert_template 'create'
+ assert_equal 'text/javascript', response.content_type
end
relation = IssueRelation.first(:order => 'id DESC')
assert_equal 3, relation.issue_from_id
assert_equal 1, relation.issue_to_id
+
+ assert_match /Bug #1/, response.body
end
def test_create_should_accept_id_with_hash
@@ -113,6 +112,19 @@ class IssueRelationsControllerTest < ActionController::TestCase
should "prevent relation creation when there's a circular dependency"
+ def test_create_xhr_with_failure
+ assert_no_difference 'IssueRelation.count' do
+ @request.session[:user_id] = 3
+ xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '999', :relation_type => 'relates', :delay => ''}
+
+ assert_response :success
+ assert_template 'create'
+ assert_equal 'text/javascript', response.content_type
+ end
+
+ assert_match /errorExplanation/, response.body
+ end
+
def test_destroy
assert_difference 'IssueRelation.count', -1 do
@request.session[:user_id] = 3
@@ -129,7 +141,11 @@ class IssueRelationsControllerTest < ActionController::TestCase
assert_difference 'IssueRelation.count', -1 do
@request.session[:user_id] = 3
xhr :delete, :destroy, :id => '2'
- assert_select_rjs :remove, 'relation-2'
+
+ assert_response :success
+ assert_template 'destroy'
+ assert_equal 'text/javascript', response.content_type
+ assert_match /relation-2/, response.body
end
end
end