Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix hash-order dependent test failure

On Ruby 1.8 >= 1.8.7-p357, hash ordering (e.g. calling 'each' or in
this case 'map') cannot be predetermined.  The result is that this
test fails 50% of the time depending on the order of iteration in
build_nested_query.

Accept either result as a valid test assertion.
  • Loading branch information...
commit de3c27e1e1bf7249e3af04710e26905e7c46e1cc 1 parent 3e1a6a8
@jeckersb jeckersb authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  test/test_utils.rb
View
2  test/test_utils.rb
@@ -22,7 +22,7 @@ def test_build_nested_query
assert_equal 'foo', build_nested_query('foo' => nil)
assert_equal 'foo=', build_nested_query('foo' => '')
assert_equal 'foo=bar', build_nested_query('foo' => 'bar')
- assert_equal 'foo=1&bar=2', build_nested_query('foo' => '1', 'bar' => '2')
+ assert ['foo=1&bar=2','bar=2&foo=1'].include?(build_nested_query('foo' => '1', 'bar' => '2'))
assert_equal 'my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F',
build_nested_query('my weird field' => 'q1!2"\'w$5&7/z8)?')
assert_equal 'foo[]', build_nested_query('foo' => [nil])
Please sign in to comment.
Something went wrong with that request. Please try again.