Sha256: dcdf240e7d72b1a5962fe2fa750714979a85c51554aef6fbc5f477fb72b0ce53

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

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

# tests for running sinatra-assetpack with an application that's mounted under a
# subdirectory
class SubpathTest < UnitTest
  def app
    Rack::URLMap.new('/subpath' => Main)
  end

  test "helpers css (mounted on a subpath, development)" do
    Main.settings.stubs(:environment).returns(:development)
    get '/subpath/helpers/css'
    assert body =~ %r{link rel='stylesheet' href='/subpath/css/screen.[a-f0-9]{32}.css' media='screen'}
  end

  test "helpers css (mounted on a subpath, production)" do
    Main.settings.stubs(:environment).returns(:production)
    get '/subpath/helpers/css'
    assert body =~ %r{link rel='stylesheet' href='/subpath/css/application.[a-f0-9]{32}.css' media='screen'}
  end

  test "helpers img (mounted on a subpath, development)" do
    Main.settings.stubs(:environment).returns(:development)
    get '/subpath/helpers/email'
    assert body =~ %r{src='/subpath/images/email.png'}
  end

  test "helpers img (mounted on a subpath, production)" do
    Main.settings.stubs(:environment).returns(:production)
    get '/subpath/helpers/email'
    assert body =~ %r{src='/subpath/images/email.[a-f0-9]{32}.png'}
  end

  test '/subpath/js/hello.js (plain js)' do
    get '/subpath/js/hello.js'
    assert body == '$(function() { alert("Hello"); });'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sinatra-assetpack-0.3.5 test/subpath_test.rb
sinatra-assetpack-0.3.3 test/subpath_test.rb
sinatra-assetpack-0.3.2 test/subpath_test.rb