Skip to content

Commit

Permalink
Fix specs with side effects (#12539)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Sep 30, 2022
1 parent 7036927 commit 2d6a36e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions spec/std/uri_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -393,16 +393,25 @@ describe "URI" do
it "registers port for scheme" do
URI.set_default_port("ponzi", 9999)
URI.default_port("ponzi").should eq(9999)
ensure
URI.set_default_port("ponzi", nil)
end

it "unregisters port for scheme" do
URI.set_default_port("ftp", nil)
URI.default_port("ftp").should eq(nil)
old_port = URI.default_port("ftp")
begin
URI.set_default_port("ftp", nil)
URI.default_port("ftp").should eq(nil)
ensure
URI.set_default_port("ftp", old_port)
end
end

it "treats scheme case insensitively" do
URI.set_default_port("UNKNOWN", 1234)
URI.default_port("unknown").should eq(1234)
ensure
URI.set_default_port("UNKNOWN", nil)
end
end

Expand Down

0 comments on commit 2d6a36e

Please sign in to comment.