summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dff8eff)
- _show_ to return single user only
- remove nesting for languages
- if user.languages
- json.languages do
- json.array! user.languages.split(",")
- end
- end
+ json.languages user.languages if user.languages?
json.messages do
json.received do
json.messages do
json.received do
-json.users([@user]) do |user|
- json.partial! user
-end
# check that a non-existent user is not returned
get api_user_path(:id => 0)
assert_response :not_found
# check that a non-existent user is not returned
get api_user_path(:id => 0)
assert_response :not_found
+
+ # check that a visible user is returned properly in json
+ get api_user_path(:id => user.id, :format => "json")
+ assert_response :success
+ assert_equal "application/json", response.media_type
+
+ js = ActiveSupport::JSON.decode(@response.body)
+ assert_not_nil js
+ assert_equal user.id, js["user"]["id"]