Sha256: edb49cfe224c8abcb13f35667889e6c2ccfb1bb2c5e3759737267b0975845097
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
require File.expand_path('../helper', __FILE__) require 'stringio' class RequestTest < Test::Unit::TestCase it 'responds to #user_agent' do request = aldebaran::Request.new({'HTTP_USER_AGENT' => 'Test'}) assert request.respond_to?(:user_agent) assert_equal 'Test', request.user_agent end it 'parses POST params when Content-Type is form-dataish' do request = aldebaran::Request.new( 'REQUEST_METHOD' => 'PUT', 'CONTENT_TYPE' => 'application/x-www-form-urlencoded', 'rack.input' => StringIO.new('foo=bar') ) assert_equal 'bar', request.params['foo'] end it 'is secure when the url scheme is https' do request = aldebaran::Request.new('rack.url_scheme' => 'https') assert request.secure? end it 'is not secure when the url scheme is http' do request = aldebaran::Request.new('rack.url_scheme' => 'http') assert !request.secure? end it 'respects X-Forwarded-Proto header for proxied SSL' do request = aldebaran::Request.new('HTTP_X_FORWARDED_PROTO' => 'https') assert request.secure? end it 'is possible to marshal params' do request = aldebaran::Request.new( 'REQUEST_METHOD' => 'PUT', 'CONTENT_TYPE' => 'application/x-www-form-urlencoded', 'rack.input' => StringIO.new('foo=bar') ) params = aldebaran::Base.new!.send(:indifferent_hash).replace(request.params) dumped = Marshal.dump(request.params) assert_equal 'bar', Marshal.load(dumped)['foo'] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aldebaran-1.0.1 | test/request_test.rb |