Sha256: 8b5e9848f0b473280b9f03b5b451d36109af69f48f0734ba73ddfeb5684bff34

Contents?: true

Size: 861 Bytes

Versions: 3

Compression:

Stored size: 861 Bytes

Contents

require 'spec/spec_helper'

describe "esi user agent variable 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 == ["<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html><body>\nENDAEN-GB\n</body></html>\n"]
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
joshbuddy-esi-for-rack-0.0.1 spec/http_integration/accept_language_spec.rb
joshbuddy-esi-for-rack-0.0.2 spec/http_integration/accept_language_spec.rb
joshbuddy-esi-for-rack-0.0.3 spec/http_integration/accept_language_spec.rb