Sha256: aa65a6413c9baa9c6775f9bbd37ce845902a11faed27c3d180d80b4443633857

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

require 'spec/spec_helper'

describe "esi accept language lookups" do
  
  it "should lookup a cookie variable" do
    
    vars = {'type' => 'user'}
    builder = Rack::Builder.new do
      use EsiForRack, {'/file/WIN' => 'os', '/file/1.5' => 'version', '/file/MOZILLA' => 'browser'}

      run proc { |env|
        data = IO.read('spec/http_integration/fixtures/accept_language/1.html')
        [200, {'Content-type' => 'text/html', 'Content-length' => data.size.to_s}, [data]]
      }
    end

    request = Rack::MockRequest.env_for("/?#{Rack::Utils.build_query(vars)}")
    request['HTTP_ACCEPT_LANGUAGE'] = 'da, en-gb;q=0.8, en;q=0.7'
    builder.call(request).last.should == ["<html><body>\nEN\nDA\nEN-GB\n\n</body></html>"]
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
esi-for-rack-0.0.4 spec/http_integration/accept_language_spec.rb