Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from rails/schneems/fix-windows-4.x
[close #115] Support Windows filesystem
- Loading branch information
Showing
2 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'sprockets_test' | ||
|
||
class TestURITar < Sprockets::TestCase | ||
test "works with windows" do | ||
fake_env = Class.new do | ||
include Sprockets::PathUtils | ||
attr_accessor :root | ||
end.new | ||
|
||
uri = "C:/Sites/sprockets/test/fixtures/paths/application.css?type=text/css" | ||
fake_env.root = "C:/Different/path" | ||
tar = Sprockets::URITar.new(uri, fake_env) | ||
assert_equal uri, tar.expand | ||
assert_equal uri, tar.compress | ||
assert_equal uri, tar.compressed_path | ||
|
||
uri = "file:///C:/Sites/sprockets/test/fixtures/paths/application.css?type=text/css" | ||
fake_env.root = "C:/Sites/sprockets" | ||
tar = Sprockets::URITar.new(uri, fake_env) | ||
assert_equal uri, tar.expand | ||
assert_equal Sprockets::URITar.new(tar.expand, fake_env).expand, tar.expand | ||
assert_equal "test/fixtures/paths/application.css?type=text/css", tar.compressed_path | ||
assert_equal "file://test/fixtures/paths/application.css?type=text/css", tar.compress | ||
assert_equal Sprockets::URITar.new(tar.compress, fake_env).compress, tar.compress | ||
assert_equal Sprockets::URITar.new(tar.expand, fake_env).compress, tar.compress | ||
|
||
uri = "C:/Sites/sprockets/test/fixtures/paths/application.css?type=text/css" | ||
fake_env.root = "C:/Sites/sprockets" | ||
tar = Sprockets::URITar.new(uri, fake_env) | ||
assert_equal uri, tar.expand | ||
assert_equal "test/fixtures/paths/application.css?type=text/css", tar.compressed_path | ||
assert_equal "test/fixtures/paths/application.css?type=text/css", tar.compress | ||
end | ||
end |