D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby18
/
lib64
/
ruby
/
gems
/
1.8
/
doc
/
rack-1.6.1
/
rdoc
/
classes
/
Rack
/
Filename :
MockRequest.html
back
Copy
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: Rack::MockRequest</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Class</strong></td> <td class="class-name-in-header">Rack::MockRequest</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../files/lib/rack/mock_rb.html"> lib/rack/mock.rb </a> <br /> </td> </tr> <tr class="top-aligned-row"> <td><strong>Parent:</strong></td> <td> Object </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <p> <a href="MockRequest.html">Rack::MockRequest</a> helps testing your <a href="../Rack.html">Rack</a> application without actually using HTTP. </p> <p> After performing a <a href="MockRequest.html#M000275">request</a> on a URL with get/post/put/patch/delete, it returns a <a href="MockResponse.html">MockResponse</a> with useful helper methods for effective testing. </p> <p> You can pass a hash with additional configuration to the get/post/put/patch/delete. </p> <table> <tr><td valign="top"><tt>:input</tt>:</td><td>A String or IO-like to be used as rack.input. </td></tr> <tr><td valign="top"><tt>:fatal</tt>:</td><td>Raise a <a href="MockRequest/FatalWarning.html">FatalWarning</a> if the app writes to rack.errors. </td></tr> <tr><td valign="top"><tt>:lint</tt>:</td><td>If true, wrap the application in a <a href="Lint.html">Rack::Lint</a>. </td></tr> </table> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000272">delete</a> <a href="#M000277">env_for</a> <a href="#M000268">get</a> <a href="#M000273">head</a> <a href="#M000267">new</a> <a href="#M000274">options</a> <a href="#M000276">parse_uri_rfc2396</a> <a href="#M000271">patch</a> <a href="#M000269">post</a> <a href="#M000270">put</a> <a href="#M000275">request</a> </div> </div> </div> <!-- if includes --> <div id="section"> <div id="class-list"> <h3 class="section-bar">Classes and Modules</h3> Class <a href="MockRequest/FatalWarner.html" class="link">Rack::MockRequest::FatalWarner</a><br /> Class <a href="MockRequest/FatalWarning.html" class="link">Rack::MockRequest::FatalWarning</a><br /> </div> <div id="constants-list"> <h3 class="section-bar">Constants</h3> <div class="name-list"> <table summary="Constants"> <tr class="top-aligned-row context-row"> <td class="context-item-name">DEFAULT_ENV</td> <td>=</td> <td class="context-item-value">{ "rack.version" => Rack::VERSION, "rack.input" => StringIO.new, "rack.errors" => StringIO.new, "rack.multithread" => true, "rack.multiprocess" => true, "rack.run_once" => false, }</td> </tr> </table> </div> </div> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Class methods</h3> <div id="method-M000277" class="method-detail"> <a name="M000277"></a> <div class="method-heading"> <a href="MockRequest.src/M000277.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000277.html');return false;"> <span class="method-name">env_for</span><span class="method-args">(uri="", opts={})</span> </a> </div> <div class="method-description"> <p> Return the <a href="../Rack.html">Rack</a> environment used for a <a href="MockRequest.html#M000275">request</a> to <tt>uri</tt>. </p> </div> </div> <div id="method-M000267" class="method-detail"> <a name="M000267"></a> <div class="method-heading"> <a href="MockRequest.src/M000267.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000267.html');return false;"> <span class="method-name">new</span><span class="method-args">(app)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000276" class="method-detail"> <a name="M000276"></a> <div class="method-heading"> <a href="MockRequest.src/M000276.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000276.html');return false;"> <span class="method-name">parse_uri_rfc2396</span><span class="method-args">(uri)</span> </a> </div> <div class="method-description"> <p> For historical reasons, we‘re pinning to RFC 2396. It‘s easier for users and we <a href="MockRequest.html#M000268">get</a> support from ruby 1.8 to 2.2 using this method. </p> </div> </div> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000272" class="method-detail"> <a name="M000272"></a> <div class="method-heading"> <a href="MockRequest.src/M000272.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000272.html');return false;"> <span class="method-name">delete</span><span class="method-args">(uri, opts={})</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000268" class="method-detail"> <a name="M000268"></a> <div class="method-heading"> <a href="MockRequest.src/M000268.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000268.html');return false;"> <span class="method-name">get</span><span class="method-args">(uri, opts={})</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000273" class="method-detail"> <a name="M000273"></a> <div class="method-heading"> <a href="MockRequest.src/M000273.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000273.html');return false;"> <span class="method-name">head</span><span class="method-args">(uri, opts={})</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000274" class="method-detail"> <a name="M000274"></a> <div class="method-heading"> <a href="MockRequest.src/M000274.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000274.html');return false;"> <span class="method-name">options</span><span class="method-args">(uri, opts={})</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000271" class="method-detail"> <a name="M000271"></a> <div class="method-heading"> <a href="MockRequest.src/M000271.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000271.html');return false;"> <span class="method-name">patch</span><span class="method-args">(uri, opts={})</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000269" class="method-detail"> <a name="M000269"></a> <div class="method-heading"> <a href="MockRequest.src/M000269.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000269.html');return false;"> <span class="method-name">post</span><span class="method-args">(uri, opts={})</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000270" class="method-detail"> <a name="M000270"></a> <div class="method-heading"> <a href="MockRequest.src/M000270.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000270.html');return false;"> <span class="method-name">put</span><span class="method-args">(uri, opts={})</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000275" class="method-detail"> <a name="M000275"></a> <div class="method-heading"> <a href="MockRequest.src/M000275.html" target="Code" class="method-signature" onclick="popupCode('MockRequest.src/M000275.html');return false;"> <span class="method-name">request</span><span class="method-args">(method="GET", uri="", opts={})</span> </a> </div> <div class="method-description"> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>