spec/plugin/assets_spec.rb in roda-1.3.0 vs spec/plugin/assets_spec.rb in roda-2.0.0
- old
+ new
@@ -330,15 +330,15 @@
js = body($1)
js.should include('console.log')
end
it '#assets should include attributes given' do
- app.new.assets([:js, :head], 'a'=>'b').should == '<script type="text/javascript" a="b" src="/assets/js/head/app.js"></script>'
+ app.allocate.assets([:js, :head], 'a'=>'b').should == '<script type="text/javascript" a="b" src="/assets/js/head/app.js"></script>'
end
it '#assets should escape attribute values given' do
- app.new.assets([:js, :head], 'a'=>'b"e').should == '<script type="text/javascript" a="b"e" src="/assets/js/head/app.js"></script>'
+ app.allocate.assets([:js, :head], 'a'=>'b"e').should == '<script type="text/javascript" a="b"e" src="/assets/js/head/app.js"></script>'
end
it 'requests for assets should return 304 if the asset has not been modified' do
loc = '/assets/js/head/app.js'
lm = header('Last-Modified', loc)
@@ -395,19 +395,19 @@
end
it 'should support :precompiled option' do
app.plugin :assets, :precompiled=>metadata_file
File.exist?(metadata_file).should == false
- app.new.assets([:js, :head]).should == '<script type="text/javascript" src="/assets/js/head/app.js"></script>'
+ app.allocate.assets([:js, :head]).should == '<script type="text/javascript" src="/assets/js/head/app.js"></script>'
app.compile_assets
File.exist?(metadata_file).should == true
- app.new.assets([:js, :head]).should =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
+ app.allocate.assets([:js, :head]).should =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
app.plugin :assets, :compiled=>false, :precompiled=>false
- app.new.assets([:js, :head]).should == '<script type="text/javascript" src="/assets/js/head/app.js"></script>'
+ app.allocate.assets([:js, :head]).should == '<script type="text/javascript" src="/assets/js/head/app.js"></script>'
app.plugin :assets, :precompiled=>metadata_file
- app.new.assets([:js, :head]).should =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
+ app.allocate.assets([:js, :head]).should =~ %r{src="(/assets/app\.head\.[a-f0-9]{40}\.js)"}
end
end
end