提交 b311b7b3 编写于 作者: M Mislav Marohnić

Ensure tests use URI from speedy_stdlib even if Bundler loaded URI

When running through `bundle exec`, Bundler will have loaded URI already
which will make our speedy_stdlib skip redefining it.

Aggressively undefine URI if loaded through Bundler so that our tests
perform against our implementation, not the stdlib one.
上级 38dbd312
if defined?(Bundler) && defined?(URI)
Object.send(:remove_const, :URI)
$".reject! { |p| p =~ %r{(^|/)uri[/.]} }
end
require 'minitest/autorun'
require 'hub'
......
require 'helper'
class URITest < Minitest::Test
def test_uri_is_from_speedy_stdlib
# if it were stdlib, URI::HTTPS would be the result
assert_equal URI::HTTP, URI.parse("https://example.com").class
end
def test_uri_display_port
assert_equal "https://example.com", URI.parse("https://example.com").to_s
assert_equal "https://example.com:80", URI.parse("https://example.com:80").to_s
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册