Skip to content

Commit

Permalink
Compare raw query instead of parsed one
Browse files Browse the repository at this point in the history
  • Loading branch information
ixti committed Apr 16, 2014
1 parent 690089b commit 522d3ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/http/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def simple_response(body, status = 200)

it 'merges duplicate values' do
expect(HTTP::Request).to receive(:new) do |_, uri|
expect(CGI.parse uri.query).to eq('a' => %w[1 2])
expect(uri.query).to eq 'a=1&a=2'

This comment has been minimized.

Copy link
@sferik

sferik Apr 16, 2014

Contributor

This creates an indirect dependency on hash ordering.

This comment has been minimized.

Copy link
@ixti

ixti Apr 16, 2014

Author Member

hm. true. and actually didn't fixed an issue (although it was OK on my machine) :((
what do you think about:

query = CGI.parse uri.query
expect(query["a"].sort).to eq %w[1 2]

This comment has been minimized.

Copy link
@sferik

sferik Apr 16, 2014

Contributor

@johnny5- We need to worry about this, since we still support Ruby 1.8.7 and this is causing the build to fail.

@ixti That should fix it. Alternately, you could do something like this:

expect(uri.query).to match(/a=[1|2]&a=[1|2]/)

This comment has been minimized.

Copy link
@ixti

ixti Apr 16, 2014

Author Member

OK. Fixed. @sferik I believe you meant /a=[12]&a=[12]/. Anyway I made it more strict-ish :D

end

client.get('http://example.com/?a=1', :params => {:a => 2})
Expand Down

0 comments on commit 522d3ed

Please sign in to comment.