Sha256: d21b42efc400b0e79dc7b3c377d1d083ddc7169578a012aba595e55948e690e6

Contents?: true

Size: 1.72 KB

Versions: 3

Compression:

Stored size: 1.72 KB

Contents

require 'helper'

class WebTest < Test::Unit::TestCase
  
  get '/foo' do
    should_respond_with 404
    should("render an empty string") { assert_equal '', last_response.body }
  end
  
  get '/SampleFont.css' do
    should_respond_with 200
    should_set_header 'Content-Type', 'text/css;charset=utf-8'
    should_set_caching
    should_have_rendered_css 'SampleFont'
  end
  
  get '/CustomCSS.css' do
    should_respond_with 200
    should_set_header 'Content-Type', 'text/css;charset=utf-8'
    should_set_caching
    should_have_rendered_css 'CustomCSS'
  end
  
  get '/LicenseFont.css' do
    should_respond_with 200
    should_set_header 'Content-Type', 'text/css;charset=utf-8'
    should_set_caching
    should_have_rendered_css 'LicenseFont'
  end

  %w(eot otf svg ttf woff).each do |format|
    get "/SampleFont.#{format}" do
      should_respond_with 200
      should_set_content_type_for format
      should_set_caching
    end
  end  
  
  %w(otf svg ttf woff).each do |format|
    get "/AnotherFont.#{format}" do
      should_respond_with 200
      should_set_content_type_for format
      should_set_caching
    end
  end
  
  get '/AnotherFont.eot' do
    should_respond_with 404
    should_not_set_caching
  end
  
  %w(eot otf svg woff).each do |format|
    get "/SimpleFont.#{format}" do
      should_respond_with 404
      should_not_set_caching
    end
  end
  
  get '/' do
    should_respond_with 200
    should_set_header 'Content-Type', 'text/html;charset=utf-8'
  end
  
  context "when demo is deactivated" do
    setup do
      Rack::Fontserve.set :demo, false
    end
    
    get '/' do
      should_respond_with 404
      should_not_set_caching
    end
    
    teardown do
      Rack::Fontserve.set :demo, true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-fontserve-0.2.0 test/test_web.rb
rack-fontserve-0.1.4 test/test_web.rb
rack-fontserve-0.1.3 test/test_web.rb