Skip to content

assert_serializer in Rails 5 #1939

Open
@BScharbau

Description

@BScharbau

I want to do unit testing on my controllers in a Rails 5 API only environment. I want to make sure that the correct serializer is used for serializing the response. I therefore want to use the assert_serializer assertion.

Expected behavior vs actual behavior

Expected: Serializer is tested, actual: Rails 5 doesn't know the assert_serializer function. Error log on rake test:

NameError: undefined local variable or method `assert_response_schema' for #<UsersControllerTest:0x007fa4f80a24f0>
Did you mean?  assert_response

Steps to reproduce

Make a new Rails 5 API only project, include active_model_serializers and try to run the assertion in a test

Environment

ActiveModelSerializers Version (commit ref if not on tag):
0.10.2

Output of ruby -e "puts RUBY_DESCRIPTION":
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]

OS Type & Version:

OSX El Capitan

Integrated application and version (e.g., Rails, Grape, etc):
Rails 5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions