require_relative "test_helper" class FunctionsTest < SassCTest class CustomImporter < SassC::Importer def imports(path, parent_path) if path =~ /styles/ [ Import.new("#{path}1.scss", source: "$var1: #000;"), Import.new("#{path}2.scss") ] else Import.new(path) end end end class NoFilesImporter < SassC::Importer def imports(path, parent_path) [] end end class OptionsImporter < SassC::Importer def imports(path, parent_path) Import.new("name.scss", source: options[:custom_option_source]) end end def around within_construct do |construct| @construct = construct yield end @construct = nil end def test_custom_importer_works @construct.file("styles2.scss", ".hi { color: $var1; }") @construct.file("fonts.scss", ".font { color: $var1; }") data = <