Better test to ensure that query strings are not being rewritten. #66

Merged
merged 1 commit into from Nov 13, 2012

Conversation

Projects
None yet
2 participants
Contributor

pdg137 commented Sep 27, 2012

No description provided.

@pdg137 pdg137 Better test to ensure that query strings are not being rewritten. The…
… previous version of this test would pass on revision 8153c07 with Ruby 1.9 due to ordered hashes; this one checks both argument order and URL-encoding.
c14ce34
Collaborator

brynary commented Nov 11, 2012

Thanks for the PR. Looks good, but can you help me understand the motivation. Did you run into a bug here?

Contributor

pdg137 commented Nov 12, 2012

The test should make sure that the order of arguments is not changed from the original query string. I was doing my original testing on Ruby 1.8.7, which uses unordered hashes, so if my arguments were split up into a hash, they got randomized, causing the test to fail with high probability, as desired. In 1.9, the hashes are ordered, which I believe results in an alphabetically-ordered list of params. Since my original simple query string was already in alphabetical order, it did not get rearranged, making it a useless test on 1.9.

This new version uses a query string with arguments that are not in alphabetical order, so it should be more rigorous. Also, I added the +%20 to test whether any kind of URL-decoding/encoding is being applied, which catches it even if the argument order does not change.

brynary merged commit 5652789 into rack-test:master Nov 13, 2012

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment