diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml index c656e5039..efbf59123 100644 --- a/test/fixtures/comments.yml +++ b/test/fixtures/comments.yml @@ -14,4 +14,8 @@ post_2_thanks_man: id: 3 post_id: 2 body: Thanks man. Great post. But what is JR? - author_id: 2 \ No newline at end of file + author_id: 2 + +rogue_comment: + body: Rogue Comment Here + author_id: 3 \ No newline at end of file diff --git a/test/integration/requests/request_test.rb b/test/integration/requests/request_test.rb index d944dd660..4050a7724 100644 --- a/test/integration/requests/request_test.rb +++ b/test/integration/requests/request_test.rb @@ -180,15 +180,15 @@ def test_put_update_association_has_one def test_patch_update_association_has_many_acts_as_set # Comments are acts_as_set=false so PUT/PATCH should respond with 403 - like = Comment.find_by(body: 'i liked it') - patch '/posts/3/links/comments', { 'data' => [{type: 'comments', id: like.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE + rogue = Comment.find_by(body: 'Rogue Comment Here') + patch '/posts/5/links/comments', { 'data' => [{type: 'comments', id: rogue.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE assert_equal 403, status end def test_post_update_association_has_many - like = Comment.find_by(body: 'i liked it') - post '/posts/3/links/comments', { 'data' => [{type: 'comments', id: like.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE + rogue = Comment.find_by(body: 'Rogue Comment Here') + post '/posts/5/links/comments', { 'data' => [{type: 'comments', id: rogue.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE assert_equal 204, status end @@ -196,8 +196,8 @@ def test_post_update_association_has_many def test_put_update_association_has_many_acts_as_set # Comments are acts_as_set=false so PUT/PATCH should respond with 403. Note: JR currently treats PUT and PATCH as equivalent - like = Comment.find_by(body: 'i liked it') - put '/posts/3/links/comments', { 'data' => [{type: 'comments', id: like.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE + rogue = Comment.find_by(body: 'Rogue Comment Here') + put '/posts/5/links/comments', { 'data' => [{type: 'comments', id: rogue.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE assert_equal 403, status end