summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-04-12 09:20:02 +0000
committerGo MAEDA <maeda@farend.jp>2021-04-12 09:20:02 +0000
commit5b95f064e03a49253e7b6c1e01fb81eb86c9f6e9 (patch)
tree2db4bb433b08e0d25e222b66a620d297555b17ea /test/integration
parent2c773d63930cd721c123cb7088d66865b62ca527 (diff)
downloadredmine-5b95f064e03a49253e7b6c1e01fb81eb86c9f6e9.tar.gz
redmine-5b95f064e03a49253e7b6c1e01fb81eb86c9f6e9.zip
Fix undefined method 'split' when issue_to_id is numeric (#35039).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@20932 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api_test/issue_relations_test.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/integration/api_test/issue_relations_test.rb b/test/integration/api_test/issue_relations_test.rb
index cc9a9a13b..80caaa9f4 100644
--- a/test/integration/api_test/issue_relations_test.rb
+++ b/test/integration/api_test/issue_relations_test.rb
@@ -42,7 +42,7 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base
assert_difference('IssueRelation.count') do
post(
'/issues/2/relations.xml',
- :params => {:relation => {:issue_to_id => 7, :relation_type => 'relates'}},
+ :params => {:relation => {:issue_to_id => "7", :relation_type => 'relates'}},
:headers => credentials('jsmith')
)
end
@@ -57,6 +57,27 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base
assert_select 'relation id', :text => relation.id.to_s
end
+ test "POST /issues/:issue_id/relations.json with numeric issue to id should create the relation" do
+ assert_difference('IssueRelation.count') do
+ post(
+ '/issues/2/relations.json',
+ :params => {:relation => {:issue_to_id => 7, :relation_type => 'relates'}},
+ :headers => credentials('jsmith'),
+ :as => :json
+ )
+ end
+
+ relation = IssueRelation.order('id DESC').first
+ assert_equal 2, relation.issue_from_id
+ assert_equal 7, relation.issue_to_id
+ assert_equal 'relates', relation.relation_type
+
+ assert_response :created
+ assert_equal 'application/json', @response.media_type
+ json = ActiveSupport::JSON.decode(response.body)
+ assert_equal relation.id, json['relation']['id']
+ end
+
test "POST /issues/:issue_id/relations.xml with failure should return errors" do
assert_no_difference('IssueRelation.count') do
post(