-
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
Closed
Closed
Updates shoulda gems #2665
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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