Fix tests by expecting TypeError for Ruby 2.2#53
Closed
strzibny wants to merge 1 commit intochrisk:masterfrom
Closed
Fix tests by expecting TypeError for Ruby 2.2#53strzibny wants to merge 1 commit intochrisk:masterfrom
strzibny wants to merge 1 commit intochrisk:masterfrom
Conversation
zeha
added a commit
to zeha/fakeweb
that referenced
this pull request
Mar 3, 2016
Applies on top of the changes for 2.2 (chrisk#53).
chrisk
added a commit
that referenced
this pull request
Jun 21, 2017
The existing test below, #register_uri_without_domain_name, was
mistakenly constructed to call FakeWeb.register_uri with a string for
the third argument rather than an options hash as in all other
invocations. This was masked by the invalid second argument (trying to
use 'test_example2.txt' as a domain name) because FakeWeb checks that
first.
As of Ruby 2.2, URI supports parsing domain names that use the new
generic top-level domains (gTLDs), such as .info, .tech, etc. Although
.txt is not an active TLD, URI no longer concerns itself with this
problem and now only raises a URI::InvalidURIError when a domain name is
syntactically invalid. So starting with Ruby 2.2, the error in this test
was no longer masked.
It started raising this instead:
TypeError(<no implicit conversion of Symbol into Integer>)
...because it was trying to treat the String argument as a Hash
internally.
Since that error isn't very intuitive, this adds an explicit check for
passing non-hashy objects where a hash of response options is expected,
raising an ArgumentError instead.
Thanks for reporting: @strzibny in #53, @davidcornu in #58.
chrisk
added a commit
that referenced
this pull request
Jun 21, 2017
As of Ruby 2.2, URI supports parsing domain names that use the new generic top-level domains (gTLDs), such as .info, .tech, etc. Although .txt is not an active TLD, URI no longer concerns itself with this problem and now only raises a URI::InvalidURIError when a domain name is syntactically invalid. So this test only worked on older Rubies. Thanks to @davidcornu for reporting and suggesting a new string to use in #58. Thanks also to @strzibny for reporting in #53.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes failed builds on master:
https://travis-ci.org/chrisk/fakeweb/jobs/28254294
Note: it won't show success until #48 is merged.