From a968c1b9237ea05ea1675007ba962240d8d4535a Mon Sep 17 00:00:00 2001 From: Michal Migurski Date: Fri, 9 Apr 2021 14:06:53 -0700 Subject: [PATCH] Added test for user prefs JSON response --- test/controllers/api/user_preferences_controller_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/controllers/api/user_preferences_controller_test.rb b/test/controllers/api/user_preferences_controller_test.rb index 7cfc875ef..bf36c5d44 100644 --- a/test/controllers/api/user_preferences_controller_test.rb +++ b/test/controllers/api/user_preferences_controller_test.rb @@ -62,6 +62,15 @@ module Api assert_select "preference[k=\"#{user_preference2.k}\"][v=\"#{user_preference2.v}\"]", :count => 1 end end + + # Test json + get user_preferences_path(:format => "json"), :headers => auth_header + assert_response :success + assert_equal "application/json", @response.media_type + + js = ActiveSupport::JSON.decode(@response.body) + assert_not_nil js + assert_equal 2, js["preferences"].count end ## -- 2.43.2