summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a968c1b)
This avoids the tests passing if the json output is an array of kv pairs,
instead of the desired hash of attributes.
before_action :set_request_formats
##
before_action :set_request_formats
##
- # return all the preferences as an XML document
+ # return all the preferences
def index
@user_preferences = current_user.preferences
def index
@user_preferences = current_user.preferences
{ :path => "/api/0.6/user/preferences", :method => :get },
{ :controller => "api/user_preferences", :action => "index" }
)
{ :path => "/api/0.6/user/preferences", :method => :get },
{ :controller => "api/user_preferences", :action => "index" }
)
+ assert_routing(
+ { :path => "/api/0.6/user/preferences.json", :method => :get },
+ { :controller => "api/user_preferences", :action => "index", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/user/preferences", :method => :put },
{ :controller => "api/user_preferences", :action => "update_all" }
assert_routing(
{ :path => "/api/0.6/user/preferences", :method => :put },
{ :controller => "api/user_preferences", :action => "update_all" }
js = ActiveSupport::JSON.decode(@response.body)
assert_not_nil js
assert_equal 2, js["preferences"].count
js = ActiveSupport::JSON.decode(@response.body)
assert_not_nil js
assert_equal 2, js["preferences"].count
+ assert_equal user_preference.v, js["preferences"][user_preference.k]