spec/merb-assets_spec.rb in merb-assets-0.9.7 vs spec/merb-assets_spec.rb in merb-assets-0.9.8

- old
+ new

@@ -51,10 +51,15 @@ it "should create image tag without extension and with specified path" do image_tag('charts', :path => '/dynamic/').should == "<img src=\"/dynamic/charts\" />" end + + it "should create image tag with a random query string" do + result = image_tag('foo.gif', :reload => true) + result.should match(%r{<img src="/images/foo.gif\?\d+" />}) + end end describe "JavaScript related functions" do it "should escape js having quotes" do @@ -180,10 +185,22 @@ result = css_include_tag('style.css', :layout) result.scan(/<link/).should have(2).things result.should match(%r{/stylesheets/style.css}) result.should match(%r{/stylesheets/layout.css}) end + + it "should create a js include tag with a random query string" do + Merb::Config[:reload_templates] = true + result = js_include_tag('jquery.js') + result.should match(%r{/javascripts/jquery.js\?\d+}) + Merb::Config[:reload_templates] = false + end + it "should create a css include tag with a random query string" do + result = css_include_tag('style.css', :reload => true) + result.should match(%r{/stylesheets/style.css\?\d+}) + end + it "should create a css include tag with the specified media" do css_include_tag('style', :media => :print).should match(%r{media="print"}) end it "should create a css include tag with the specified charset" do