openid/ruby-openid — pull request #82 by ktdreyer (2014-11-09 05:22:40+00:00)
Title: Minitest

The first commit in this pull request switches from the deprecated Test::Unit to Minitest 5. I've added a bit of code for backwards compatibility with Minitest 4 inside `test/testutil.rb`. This commit also drops Ruby 1.9.2 from Travis, since this has issues with the latest verison of Minitest, and Ruby 1.9.2 is not supported upstream any more. It also removes the crufty `admin/runtest.rb`, since this is deprecated in favor of simply running `rake` to execute the test suite.

The second commit fixes an odd problem in test_redirect_limit. The default values of body and headers ought to be "nil", but in fact they end up as the string "0" when inside `fetch()`. (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.

The third commit fixes an oversight in test_no_services. This test makes use of the with_method_overridden() function, but depending on the order in which the tests ran, this function might or might not be present. Adding the mixin during this test ensures that the test passes regardless of overall ordering during the suite's run.