typhoeus/typhoeus — pull request #194 by ifesdjeen (2012-06-30 15:48:28+00:00)
Title: Adding fuzzy matching for keys when checking for Request equality.

That will help with memoization a bit (in case options are given in a different order).

Actually, it'd be quite easy to add recursive fuzzy matching for cases:

```ruby
def fuzzy_hash_eql?(left, right)
return true if (left == right)

(left.count == right.count) && left.inject(true) do |res, kvp|
if kvp[1].is_a?(Hash)
res && fuzzy_hash_eql?(kvp[1], right[kvp[0]])
else
res && (kvp[1] == right[kvp[0]])
end
end
end
```

```ruby
context "when same url and same options are given, and second-level options have different order" do
let(:left_options) { {:verbose => true, :headers => { 'User-Agent' => "Fubar", 'Accept' => "text/plain, text/html" }} }
let(:right_options) { {:headers => { 'Accept' => "text/plain, text/html", 'User-Agent' => "Fubar" }, :verbose => true} }

let(:left_request) { Typhoeus::Request.new("url", left_options) }
let(:right_request) { Typhoeus::Request.new("url", right_options) }

it "returns true" do
left_request.should eql right_request
end
end
```