spec/sprockets-sass_spec.rb in sprockets-sass-0.1.0 vs spec/sprockets-sass_spec.rb in sprockets-sass-0.2.0
- old
+ new
@@ -93,19 +93,42 @@
@assets.file "main.css.scss", %(@import "dep";\nbody { color: $color; })
vendor.file "dep.scss", "$color: blue;"
asset = @env["main.css.scss"]
asset.to_s.should == "body {\n color: blue; }\n"
end
+
+ it "imports globbed files" do
+ @assets.file "main.css.scss", %(@import "folder/*";\nbody { color: $color; background: $bg-color; })
+ @assets.file "folder/dep1.css.scss", "$color: blue;"
+ @assets.file "folder/dep2.css.scss", "$bg-color: red;"
+ asset = @env["main.css.scss"]
+ asset.to_s.should == "body {\n color: blue;\n background: red; }\n"
+ end
- it "adds dependency when imported" do
+ it "adds dependencies when imported" do
@assets.file "main.css.scss", %(@import "dep";\nbody { color: $color; })
dep = @assets.file "dep.css.scss", "$color: blue;"
asset = @env["main.css.scss"]
asset.should be_fresh
mtime = Time.now + 1
dep.open("w") { |f| f.write "$color: red;" }
+ dep.utime mtime, mtime
+
+ asset.should be_stale
+ end
+
+ it "adds dependencies when imported from a glob" do
+ @assets.file "main.css.scss", %(@import "folder/*";\nbody { color: $color; background: $bg-color; })
+ @assets.file "folder/dep1.css.scss", "$color: blue;"
+ dep = @assets.file "folder/dep2.css.scss", "$bg-color: red;"
+
+ asset = @env["main.css.scss"]
+ asset.should be_fresh
+
+ mtime = Time.now + 1
+ dep.open("w") { |f| f.write "$bg-color: white;" }
dep.utime mtime, mtime
asset.should be_stale
end
end