From 3f00a2638756edffa68566a09e89d1495e8bf91f Mon Sep 17 00:00:00 2001 From: AI-Mozi Date: Wed, 10 May 2023 16:28:18 +0200 Subject: [PATCH] add spec for `URI#parse` --- library/uri/generic/host_spec.rb | 7 ++++++- library/uri/generic/to_s_spec.rb | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/library/uri/generic/host_spec.rb b/library/uri/generic/host_spec.rb index f2076d2bc1..2de0e7ec09 100644 --- a/library/uri/generic/host_spec.rb +++ b/library/uri/generic/host_spec.rb @@ -2,7 +2,12 @@ require 'uri' describe "URI::Generic#host" do - it "needs to be reviewed for spec completeness" + ruby_version_is "3.2" do + # https://hackerone.com/reports/156615 + it "returns empty string when host is empty" do + URI.parse('http:////foo.com').host.should == '' + end + end end describe "URI::Generic#host=" do diff --git a/library/uri/generic/to_s_spec.rb b/library/uri/generic/to_s_spec.rb index 8c90d7645b..1dd1f2d134 100644 --- a/library/uri/generic/to_s_spec.rb +++ b/library/uri/generic/to_s_spec.rb @@ -2,5 +2,10 @@ require 'uri' describe "URI::Generic#to_s" do - it "needs to be reviewed for spec completeness" + ruby_version_is "3.2" do + # https://hackerone.com/reports/156615 + it "preserves / characters when host is empty" do + URI('http:///foo.com').to_s.should == 'http:///foo.com' + end + end end