Use Rack to generate query information under test #33093
Merged
Conversation
`to_query` sorts parameters before encoding them. This causes a round tripping issue as noted here: #23997 (comment) #10529 (comment) #30558 Unfortunately, that method is being used to generate cache keys, so its results need to be stable: 10dec0e However, the test harness is only using `to_query` to encode parameters before sending them to the controller so the "cache key" usecase doesn't apply here. This commit adds a test that demonstrates the round trip problems and changes the serialization strategy to use Rack for encoding the parameters rather than `to_query`.
I think the GET case has the same problem, but I don't have a failing test for it yet so I didn't touch it. |
tenderlove
added a commit
that referenced
this pull request
Jun 12, 2018
Use Rack to generate query information under test
tenderlove
added a commit
that referenced
this pull request
Jun 12, 2018
Use Rack to generate query information under test
tenderlove
added a commit
that referenced
this pull request
Jun 12, 2018
Use Rack to generate query information under test
This cause a regression when you pass Active Record objects to the parameters. Before when you do: post :foo, params: { user: User.first } You would get in the controller Now you will get This change in behavior should be fine for the master branch if we deprecate it, but for stable branches this will break some people tests. (I found this because some tests broke when upgrading shopify to the stable branch) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
to_query
sorts parameters before encoding them. This causes a roundtripping issue as noted here:
#23997 (comment)
#10529 (comment)
#30558
Unfortunately, that method is being used to generate cache keys, so its
results need to be stable:
10dec0e
However, the test harness is only using
to_query
to encode parametersbefore sending them to the controller so the "cache key" usecase doesn't
apply here.
This commit adds a test that demonstrates the round trip problems and
changes the serialization strategy to use Rack for encoding the
parameters rather than
to_query
.