Skip to content

Commit 72b4495

Browse files
committed
Adds tests posting empty data and posting data with only required type
1 parent d17ed92 commit 72b4495

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

test/integration/requests/request_test.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,30 @@ def test_post_single
156156
assert_equal 201, status
157157
end
158158

159+
def test_post_single_missing_data_contents
160+
post '/posts',
161+
{
162+
'data' => {
163+
}
164+
}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE
165+
166+
assert_equal 400, status
167+
end
168+
169+
def test_post_single_minimal_valid
170+
post '/comments',
171+
{
172+
'data' => {
173+
'type' => 'comments'
174+
}
175+
}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE
176+
177+
assert_equal 201, status
178+
assert_nil json_response['data']['body']
179+
assert_nil json_response['data']['links']['post']['linkage']
180+
assert_nil json_response['data']['links']['author']['linkage']
181+
end
182+
159183
def test_post_single_minimal_invalid
160184
post '/posts',
161185
{

0 commit comments

Comments
 (0)