Answer the question
In order to leave comments, you need to log in
Minitest respond type?
Hello. I have a test, and for some reason it does not pass validation in the controller for the data type of the parameter, although if I pass postman data, then everything is fine. It seems like a minitest changes the type of parameters.
test 'valid get top posts' do
body = { count: 3 }
post '/top_posts', params: body
assert_response :success
end
Failure:
PostsControllerTest#test_valid_get_top_posts [/app/test/controllers/posts_controller_test.rb:34]:
Expected response to be a <2XX: success>, but was a <422: Unprocessable Entity>
Response body: {"errors":{"count":["must be an integer"]}}
Answer the question
In order to leave comments, you need to log in
Or can you show the controller code, and what you use for validation, judging by the error output, it looks very much like dry-validation
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question