Sha256: cf812ca27a5151f19dd2fd8140955ca7fc08faa795f90fd06c22ce649dcfe53a

Contents?: true

Size: 788 Bytes

Versions: 11

Compression:

Stored size: 788 Bytes

Contents

require File.expand_path('../test_helper', __FILE__)

class BusterHelpersTest < UnitTest
  include Sinatra::AssetPack

  test "adds md5 to name for one file" do
    filename = BusterHelpers.add_cache_buster '/css/style.css', asset('css/style.css')
    assert %r{/css/style.[a-f0-9]{32}.css} =~ filename
  end


  test "adds md5 to name for multiple files" do
    filename = BusterHelpers.add_cache_buster '/css/style.css', asset('css/style.css'), asset('css/js2c.css')
    assert %r{\/css\/style.[a-f0-9]{32}.css} =~ filename
  end

  test "doesn't add md5 for non-existent file" do
    assert_equal '/css/style.css', BusterHelpers.add_cache_buster('/css/style.css', 'asdf')
  end

  private

  def asset(file)
    File.expand_path(File.dirname(__FILE__)) + '/app/app/' + file
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sinatra-assetpack-0.3.5 test/buster_helpers_test.rb
sinatra-assetpack-0.3.3 test/buster_helpers_test.rb
sinatra-assetpack-0.3.2 test/buster_helpers_test.rb
sinatra-assetpack-0.3.1 test/buster_helpers_test.rb
sinatra-assetpack-0.3.0 test/buster_helpers_test.rb
sinatra-assetpack-0.2.8 test/buster_helpers_test.rb
sinatra-assetpack-0.2.7 test/buster_helpers_test.rb
sinatra-assetpack-0.2.6 test/buster_helpers_test.rb
sinatra-assetpack-0.2.5 test/buster_helpers_test.rb
sinatra-assetpack-0.2.4 test/buster_helpers_test.rb
sinatra-assetpack-0.2.3 test/buster_helpers_test.rb