42 |
42 |
assert_difference('IssueRelation.count') do
|
43 |
43 |
post(
|
44 |
44 |
'/issues/2/relations.xml',
|
45 |
|
:params => {:relation => {:issue_to_id => 7, :relation_type => 'relates'}},
|
|
45 |
:params => {:relation => {:issue_to_id => "7", :relation_type => 'relates'}},
|
46 |
46 |
:headers => credentials('jsmith')
|
47 |
47 |
)
|
48 |
48 |
end
|
... | ... | |
57 |
57 |
assert_select 'relation id', :text => relation.id.to_s
|
58 |
58 |
end
|
59 |
59 |
|
|
60 |
test "POST /issues/:issue_id/relations.json with numeric issue to id should create the relation" do
|
|
61 |
assert_difference('IssueRelation.count') do
|
|
62 |
post(
|
|
63 |
'/issues/2/relations.json',
|
|
64 |
:params => {:relation => {:issue_to_id => 7, :relation_type => 'relates'}},
|
|
65 |
:headers => credentials('jsmith'),
|
|
66 |
:as => :json
|
|
67 |
)
|
|
68 |
end
|
|
69 |
|
|
70 |
relation = IssueRelation.order('id DESC').first
|
|
71 |
assert_equal 2, relation.issue_from_id
|
|
72 |
assert_equal 7, relation.issue_to_id
|
|
73 |
assert_equal 'relates', relation.relation_type
|
|
74 |
|
|
75 |
assert_response :created
|
|
76 |
assert_equal 'application/json', @response.media_type
|
|
77 |
json = ActiveSupport::JSON.decode(response.body)
|
|
78 |
assert_equal relation.id, json['relation']['id']
|
|
79 |
end
|
|
80 |
|
60 |
81 |
test "POST /issues/:issue_id/relations.xml with failure should return errors" do
|
61 |
82 |
assert_no_difference('IssueRelation.count') do
|
62 |
83 |
post(
|