Sha256: c7e55e3eefe6961a2b525d37e866a750031361b07d1604ece7ba8d908de0a5ef
Contents?: true
Size: 905 Bytes
Versions: 2
Compression:
Stored size: 905 Bytes
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') require 'test/unit' require 'nitro/request' class TC_Request < Test::Unit::TestCase # :nodoc: all class DummyRequest include Nitro::Request def initialize @headers = {} end end def test_all req = DummyRequest.new req.headers['HTTP_HOST'] = 'www.nitrohq.com' assert_equal 'nitrohq.com', req.domain assert_equal 'www', req.subdomains.first req.headers['HTTP_HOST'] = 'www.nitrohq.co.uk' assert_equal 'nitrohq.co.uk', req.domain(2) req.headers['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' assert req.xhr? req.headers['REQUEST_METHOD'] = 'POST' req.headers['CONTENT_TYPE'] = 'application/x-yaml' assert req.yaml_post? req.instance_variable_set '@post_format', nil req.headers['CONTENT_TYPE'] = 'text/xml' assert req.xml_post? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.22.0 | test/nitro/tc_request.rb |
nitro-0.23.0 | test/nitro/tc_request.rb |