test/sass/engine_test.rb in sass-3.3.0.alpha.141 vs test/sass/engine_test.rb in sass-3.3.0.alpha.142
- old
+ new
@@ -556,11 +556,11 @@
importer = MockImporter.new
importer.add_import("foo", "@import 'bar'")
importer.add_import("bar", "@import 'foo'")
engine = Sass::Engine.new('@import "foo"', :filename => filename_for_test,
- :load_paths => [importer])
+ :load_paths => [importer], :importer => importer)
assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) {engine.render}
An @import loop has been found:
#{filename_for_test} imports foo
foo imports bar
@@ -573,11 +573,11 @@
importer.add_import("foo", "@import 'bar'")
importer.add_import("bar", "@import 'baz'")
importer.add_import("baz", "@import 'foo'")
engine = Sass::Engine.new('@import "foo"', :filename => filename_for_test,
- :load_paths => [importer])
+ :load_paths => [importer], :importer => importer)
assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) {engine.render}
An @import loop has been found:
#{filename_for_test} imports foo
foo imports bar
@@ -729,11 +729,11 @@
def test_import_from_global_load_paths
importer = MockImporter.new
importer.add_import("imported", "div{color:red}")
Sass.load_paths << importer
- assert_equal "div {\n color: red; }\n", Sass::Engine.new('@import "imported"').render
+ assert_equal "div {\n color: red; }\n", Sass::Engine.new('@import "imported"', :importer => importer).render
ensure
Sass.load_paths.clear
end
def test_nonexistent_import
@@ -3022,11 +3022,11 @@
importer = MockImporter.new
importer.add_import("imported", "div{color:red}")
original_filename = filename_for_test
engine = Sass::Engine.new('@import "imported"; div{color:blue}',
- :filename => original_filename, :load_paths => [importer], :syntax => :scss)
+ :filename => original_filename, :load_paths => [importer], :syntax => :scss, :importer => importer)
engine.render
assert_equal original_filename, engine.options[:original_filename]
assert_equal original_filename, importer.engine("imported").options[:original_filename]
end
@@ -3251,9 +3251,10 @@
assert_equal css, result
end
def render(sass, options = {})
munge_filename options
+ options[:importer] ||= MockImporter.new
Sass::Engine.new(sass, options).render
end
def renders_correctly(name, options={})
sass_file = load_file(name, "sass")