Feature #34766 ยป add_test.patch
| test/integration/api_test/api_test.rb | ||
|---|---|---|
|
assert_response :no_content
|
||
|
assert_equal '', response.body
|
||
|
end
|
||
|
def test_api_with_accept_header
|
||
|
get '/users/1.xml', :headers => credentials('admin').merge({'Accept' => 'application/xml', 'Content-type' => 'application/xml'})
|
||
|
assert_response :success
|
||
|
end
|
||
|
def test_api_with_accept_header_that_does_not_match_url
|
||
|
get '/users/1', :headers => credentials('admin').merge({'Accept' => 'application/xml', 'Content-type' => 'application/xml'})
|
||
|
assert_response :not_acceptable
|
||
|
assert_equal "We couldn't handle your request, sorry. If you were trying to access the API, make sure to append .json or .xml to your request URL.\n", response.body
|
||
|
end
|
||
|
end
|
||