From 99b7ab6110e9bf727133ce3717422cfe0d531fe8 Mon Sep 17 00:00:00 2001 From: "Gregory N. Schmit" Date: Fri, 13 Dec 2024 18:33:23 -0600 Subject: [PATCH] Fix AMS tests. --- .../api/test/active_model_serializer/marbles_controller.rb | 5 ----- .../api/test/active_model_serializer/users_controller.rb | 5 +++++ ...marbles_controller_test.rb => users_controller_test.rb} | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 test/app/controllers/api/test/active_model_serializer/marbles_controller.rb create mode 100644 test/app/controllers/api/test/active_model_serializer/users_controller.rb rename test/test/controllers/api/test/active_model_serializer/{marbles_controller_test.rb => users_controller_test.rb} (76%) diff --git a/test/app/controllers/api/test/active_model_serializer/marbles_controller.rb b/test/app/controllers/api/test/active_model_serializer/marbles_controller.rb deleted file mode 100644 index da44b5c..0000000 --- a/test/app/controllers/api/test/active_model_serializer/marbles_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Api::Test::ActiveModelSerializer::MarblesController < Api::TestController - include RESTFramework::ModelControllerMixin - - self.serializer_class = MarbleSerializer -end diff --git a/test/app/controllers/api/test/active_model_serializer/users_controller.rb b/test/app/controllers/api/test/active_model_serializer/users_controller.rb new file mode 100644 index 0000000..6e29cff --- /dev/null +++ b/test/app/controllers/api/test/active_model_serializer/users_controller.rb @@ -0,0 +1,5 @@ +class Api::Test::ActiveModelSerializer::UsersController < Api::TestController + include RESTFramework::ModelControllerMixin + + self.serializer_class = UserSerializer +end diff --git a/test/test/controllers/api/test/active_model_serializer/marbles_controller_test.rb b/test/test/controllers/api/test/active_model_serializer/users_controller_test.rb similarity index 76% rename from test/test/controllers/api/test/active_model_serializer/marbles_controller_test.rb rename to test/test/controllers/api/test/active_model_serializer/users_controller_test.rb index c7904b9..9d5ecf6 100644 --- a/test/test/controllers/api/test/active_model_serializer/marbles_controller_test.rb +++ b/test/test/controllers/api/test/active_model_serializer/users_controller_test.rb @@ -6,9 +6,10 @@ def test_list User.create!(login: "test", manager_attributes: {login: "test2"}) get(:index, as: :json) assert_response(:success) - assert(@response.parsed_body[0]["login"]) - assert(@response.parsed_body[0]["manager"]) - assert_equal("working!", @response.parsed_body[0]["test_serializer_method"]) + puts @response.parsed_body + assert(@response.parsed_body[1]["login"]) + assert(@response.parsed_body[1]["manager"]) + assert_equal("working!", @response.parsed_body[1]["test_serializer_method"]) assert_nil(@response.parsed_body[0]["calculated_property"]) end