spec/assetify/dsl_spec.rb in assetify-1.0.0 vs spec/assetify/dsl_spec.rb in assetify-2.0.0

- old
+ new

@@ -36,10 +36,16 @@ a = Assetify::DSL.parse("a 'foo', 'foolink.js'")[0] a.should be_an Asset a.fullpath.should eql("vendor/assets/javascripts/foo.js") end + it "should parse js with global 'asset' alias too" do + a = Assetify::DSL.parse("asset 'foo', 'foolink.js'")[0] + a.should be_an Asset + a.fullpath.should eql("vendor/assets/javascripts/foo.js") + end + it "should parse css with global 'a' keyword" do a = Assetify::DSL.parse("a 'foo', 'http://w.foolink/c/?foo.css'")[0] a.should be_an Asset a.fullpath.should eql("vendor/assets/stylesheets/foo.css") end @@ -61,10 +67,26 @@ a = Assetify::DSL.parse("js :jnice, 'foolink'")[0] a.should be_an Asset a.name.should eql("jnice") end + describe "Templates and Pathfixes" do + + it "should parse css to erb nicely" do + a = Assetify::DSL.parse("css 'foo', 'foolink', :as => :erb")[0] + a.should be_an Asset + a.fullpath.should eql("vendor/assets/stylesheets/foo.css.erb") + end + + it "should parse css to sass nicely" do + a = Assetify::DSL.parse("css 'foo', 'foolink', :as => :sass")[0] + a.should be_an Asset + a.fullpath.should eql("vendor/assets/stylesheets/foo.css.sass") + end + + end + describe "Group Assets" do it "should group and use a namespace" do a = Assetify::DSL.parse "group 'common' do; js 'foo', 'foolink'; end" a[0].should be_an Asset @@ -97,10 +119,16 @@ a = Assetify::DSL.parse "pkg 'fancy', 'http://fancy.zip' do; js 'foo', 'foolink'; end" a[0].should be_an Asset a[0].fullpath.should eql("vendor/assets/javascripts/fancy/foo.js") end + it "should use name as namespace too" do + a = Assetify::DSL.parse "pkg 'complex', '/tmp/complex/complex.tgz' do; dir 'images/*'; end" + a.should have(3).assets + a[0].fullpath.should eql("vendor/assets/images/complex/two.png") + end + it "should accept shallow too" do a = Assetify::DSL.parse "pkg 'fancy', 'http://fancy.zip', :shallow => true do; js 'foo', 'foolink'; end" a[0].should be_an Asset a[0].fullpath.should eql("vendor/assets/javascripts/foo.js") end @@ -111,10 +139,10 @@ a[0].fullpath.should eql("vendor/assets/javascripts/fancy/foo.js") end it "should unpack to vendor if no block given" do Pkg.should_receive(:new).with("fancy", "http://fancy.zip").and_return(mp = mock(Pkg)) - mp.should_receive :unpack_to_vendor + mp.should_receive :unpack_all a = Assetify::DSL.parse "pkg 'fancy', 'http://fancy.zip'" end end describe "Directories" do