-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates shoulda gems #2665
Updates shoulda gems #2665
Conversation
2ce4c06
to
0ef1e95
Compare
0ef1e95
to
803475d
Compare
…pt whole URL after shoulda-matchers update
# frozen_string_literal: true | ||
|
||
# TODO: remove when you see similar error but actual format is: "format"=>:json | ||
# PARAMS_TO_SYMBOLIZE causes errors in the tests regarding the format. | ||
# It always converts format to symbol which causes a failure in the tests: | ||
# Stats::Api::ApplicationsController should route GET /stats/api/applications/42/usage.json | ||
# --- expected | ||
# +++ actual | ||
# @@ -1 +1 @@ | ||
# -{"application_id"=>"42", "action"=>"usage", "format"=>:json, "controller"=>"stats/api/applications"} | ||
# +{"controller"=>"stats/api/applications", "action"=>"usage", "application_id"=>"42", "format"=>"json"} | ||
module Shoulda | ||
module Matchers | ||
module ActionController | ||
class RouteParams | ||
PARAMS_TO_SYMBOLIZE = [].freeze | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how to fix it on the other side, somehow the tests fail because shoulda-matchers is symbolizing format
values and it crashes our tests. Our controllers are returning format as a string then tests like https://github.com/3scale/porta/blob/master/test/functional/stats/api/applications_controller_test.rb#L7 fails.
I am not unable to debug it ( it will fail with other [IO] issues). There is no stack trace and also the test result is not helpful at all.
Example test result:
# Stats::Api::ApplicationsController should route GET /stats/api/applications/42/usage.json
# --- expected
# +++ actual
# @@ -1 +1 @@
# -{"application_id"=>"42", "action"=>"usage", "format"=>:json, "controller"=>"stats/api/applications"}
# +{"controller"=>"stats/api/applications", "action"=>"usage", "application_id"=>"42", "format"=>"json"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this issue comment
thoughtbot/shoulda-matchers#809 (comment)
Perhaps we need to fix in routes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do this in our case. We are using one route for multiple formats and default won't work.
One of the tests that are failing because of this: https://github.com/3scale/porta/blob/master/test/functional/stats/api/services_controller_test.rb#L7
On the other hand, when the tests are checking the controller they are parsing the path and the path contains the format which is parsed as string, not a symbol.
https://github.com/rails/rails/blob/v5.1.7/actionpack/lib/action_dispatch/routing/route_set.rb#L864
This was done in #2621 |
What this PR does / why we need it:
Updates shoulda gems to newer versions.
THREESCALE-7756: upgrade shoulda-matchers to fix BigDecimal deprecation