Permalink
Browse files

Default erb content type to text/plain

  • Loading branch information...
1 parent ed4649b commit 247ed8445017a68b664a33305b7ef1662d25ce83 @josh josh committed Jul 3, 2014
View
@@ -118,5 +118,5 @@ module Sprockets
register_engine '.scss', LazyProcessor.new { ScssTemplate }, mime_type: 'text/css'
# Other
- register_engine '.erb', LazyProcessor.new { ERBTemplate }
+ register_engine '.erb', LazyProcessor.new { ERBTemplate }, mime_type: 'text/plain'
end
No changes.
No changes.
No changes.
No changes.
No changes.
No changes.
View
@@ -804,7 +804,7 @@ def setup
assert_equal "store.css", logical_path("store.css.erb")
assert_equal "store.foo", logical_path("store.foo")
- assert_equal "files", logical_path("files.erb")
+ assert_equal "files.txt", logical_path("files.erb")
assert_equal "application.js", logical_path("application.coffee")
assert_equal "application.css", logical_path("application.scss")
@@ -870,8 +870,8 @@ def setup
assert_equal "application/javascript", content_type("project.js.coffee.erb")
assert_equal "text/css", content_type("store.css.erb")
+ assert_equal "text/plain", content_type("files.erb")
assert_equal nil, content_type("store.foo")
- assert_equal nil, content_type("files.erb")
assert_equal "application/javascript", content_type("application.coffee")
assert_equal "text/css", content_type("application.scss")
View
@@ -212,6 +212,26 @@ def self.test(name, &block)
assert_equal ".qunit {}\n", @env["qunit.css"].to_s
end
+ test "find erb assets" do
+ assert asset = @env.find_asset("erb/a")
+ assert_equal "text/plain", asset.content_type
+
+ assert asset = @env.find_asset("erb/b")
+ assert_equal "text/plain", asset.content_type
+
+ assert asset = @env.find_asset("erb/c")
+ assert_equal "application/javascript", asset.content_type
+
+ assert asset = @env.find_asset("erb/d")
+ assert_equal "text/css", asset.content_type
+
+ assert asset = @env.find_asset("erb/e")
+ assert_equal "text/html", asset.content_type
+
+ assert asset = @env.find_asset("erb/f")
+ assert_equal "text/yaml", asset.content_type
+ end
+
test "find deflate asset" do
assert asset = @env.find_asset("gallery.js", accept_encoding: "deflate")
assert_equal 'deflate', asset.encoding
@@ -298,7 +318,7 @@ def self.test(name, &block)
@env[fixture_path("default/mobile-min/index.min.js")].logical_path
end
- FILES_IN_PATH = 43
+ FILES_IN_PATH = 49
test "iterate over each logical path" do
paths = []
View
@@ -82,7 +82,7 @@ class TestPathUtils < Sprockets::TestCase
end
test "stat directory" do
- assert_equal 27, stat_directory(File.join(FIXTURE_ROOT, "default")).to_a.size
+ assert_equal 28, stat_directory(File.join(FIXTURE_ROOT, "default")).to_a.size
path, stat = stat_directory(File.join(FIXTURE_ROOT, "default")).first
assert_equal fixture_path("default/app"), path
assert_kind_of File::Stat, stat
@@ -91,7 +91,7 @@ class TestPathUtils < Sprockets::TestCase
end
test "stat tree" do
- assert_equal 53, stat_tree(File.join(FIXTURE_ROOT, "default")).to_a.size
+ assert_equal 60, stat_tree(File.join(FIXTURE_ROOT, "default")).to_a.size
path, stat = stat_tree(File.join(FIXTURE_ROOT, "default")).first
assert_equal fixture_path("default/app"), path
assert_kind_of File::Stat, stat

0 comments on commit 247ed84

Please sign in to comment.