Sha256: dcfa6efd9e3eb9a925d822c06c76f896e3f4d160e5eb95939826e5f9c0e5593f

Contents?: true

Size: 717 Bytes

Versions: 3

Compression:

Stored size: 717 Bytes

Contents

require 'cgi'

describe "CGI::QueryExtension#user_agent" do
  before(:each) do
    ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
    @cgi = CGI.new
  end

  after(:each) do
    ENV['REQUEST_METHOD'] = @old_request_method
  end

  it "returns ENV['HTTP_USER_AGENT']" do
    old_value, ENV['HTTP_USER_AGENT'] = ENV['HTTP_USER_AGENT'], "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; de-de) AppleWebKit/527+ (KHTML, like Gecko) Version/3.1 Safari/525.13"
    begin
      @cgi.user_agent.should == "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; de-de) AppleWebKit/527+ (KHTML, like Gecko) Version/3.1 Safari/525.13"
    ensure
      ENV['HTTP_USER_AGENT'] = old_value
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubysl-cgi-1.0.0 spec/queryextension/user_agent_spec.rb
rubysl-cgi-2.0.1 spec/queryextension/user_agent_spec.rb
rubysl-cgi-2.0.0 spec/queryextension/user_agent_spec.rb