Now you can run all test files individually, because each now correctly requires everything it needs.
When checking if `Digest::HMAC` is defined, we should not check ancestors, we're only interested if `HMAC` is defined on `Digest`. This will fix an issue in Ruby 2.2 where `Digest::HMAC` has been removed, but the current check will result in the `Digest` library trying to load `digest/hmac` in `Digest.const_missing` and thus causing an error.
The default values of body and headers ought to be "nil", but in fact they end up as the string "0" in test_redirect_limit. This causes all sorts of problems. When body is defined as "0", we follow the conditional that leads us to conn.request_post instead of conn.request_get, and request_post crashes since it expects a key-value string instead of simply "0". The unexpected string for the headers variable wreaks havoc as well; when headers is "0", the hash value assignment at the beginning of fetch() fails, because Ruby can't convert the string to a hash. I'm not sure why these values are "0" instead of nil, but setting them explicitly during the call fixes the bug.
If an AX attribute is set to boolean(true) value it results in undefined method `gsub' for true:TrueClass error. If it's set to false then its replaced by empty string resulting in to signature mismatch on the consumer, because the server still computes false AX value. Fix is to set val to empty string if it's nil and if it's boolean type then convert it to string.