Skip to content

Commit

Permalink
Make the URI tests pass with ruby-head
Browse files Browse the repository at this point in the history
* host is "" instead of nil, following the upstream change:
  ruby/uri@81263c9
  • Loading branch information
eregon committed Dec 20, 2022
1 parent 58eb15d commit 39490de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/sprockets/uri_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def split_file_uri(uri)
path = path[1..-1]
end

[scheme, host, path, query]
[scheme, host || '', path, query]
end

# Internal: Join file: URI component parts into String.
Expand Down
12 changes: 6 additions & 6 deletions test/test_uri_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ def test_split_file_uri
assert_equal ['file', 'localhost', '/etc/fstab', nil], parts

parts = split_file_uri("file:///etc/fstab")
assert_equal ['file', nil, '/etc/fstab', nil], parts
assert_equal ['file', '', '/etc/fstab', nil], parts

parts = split_file_uri("file:///usr/local/bin/ruby%20on%20rails")
assert_equal ['file', nil, '/usr/local/bin/ruby on rails', nil], parts
assert_equal ['file', '', '/usr/local/bin/ruby on rails', nil], parts

parts = split_file_uri("file:///usr/local/var/github/app/assets/javascripts/application.js")
assert_equal ['file', nil, '/usr/local/var/github/app/assets/javascripts/application.js', nil], parts
assert_equal ['file', '', '/usr/local/var/github/app/assets/javascripts/application.js', nil], parts

if DOSISH
parts = split_file_uri("file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc")
assert_equal ['file', nil, 'C:/Documents and Settings/davris/FileSchemeURIs.doc', nil], parts
assert_equal ['file', '', 'C:/Documents and Settings/davris/FileSchemeURIs.doc', nil], parts

parts = split_file_uri("file:///D:/Program%20Files/Viewer/startup.htm")
assert_equal ['file', nil, 'D:/Program Files/Viewer/startup.htm', nil], parts
assert_equal ['file', '', 'D:/Program Files/Viewer/startup.htm', nil], parts

parts = split_file_uri("file:///C:/Program%20Files/Music/Web%20Sys/main.html?REQUEST=RADIO")
assert_equal ['file', nil, 'C:/Program Files/Music/Web Sys/main.html', 'REQUEST=RADIO'], parts
assert_equal ['file', '', 'C:/Program Files/Music/Web Sys/main.html', 'REQUEST=RADIO'], parts
end
end

Expand Down

0 comments on commit 39490de

Please # to comment.