doc/rdoc/classes/Quarry.html in quarry-0.3.0 vs doc/rdoc/classes/Quarry.html in quarry-0.4.0

- old
+ new

@@ -1,177 +1,176 @@ <?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> - <head> - <title>Module: Quarry</title> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> - <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> - <script language="JavaScript" type="text/javascript"> - // <![CDATA[ +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Module: Quarry</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 toggleSource( id ) - { - var elem - var link + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } - if( document.getElementById ) - { - elem = document.getElementById( id ) - link = document.getElementById( "l_" + id ) - } - else if ( document.all ) - { - elem = eval( "document.all." + id ) - link = eval( "document.all.l_" + id ) - } - else - return false; + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; - if( elem.style.display == "block" ) - { - elem.style.display = "none" - link.innerHTML = "show source" - } - else - { - elem.style.display = "block" - link.innerHTML = "hide source" - } - } + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } - function openCode( url ) - { - window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus(); - } - // ]]> - </script> - </head> + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> - <body> - <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr> - <td class="file-title"><span class="file-title-prefix">Module</span><br />Quarry</td> - <td align="right"> - <table cellspacing="0" cellpadding="2"> - <tr valign="top"> - <td>In:</td> - <td> -<a href="../files/lib/quarry/methodprobe_rb.html">lib/quarry/methodprobe.rb</a> -<a href="../files/lib/quarry/mock/object_rb.html">lib/quarry/mock/object.rb</a> -<a href="../files/lib/quarry/design/spec_rb.html">lib/quarry/design/spec.rb</a> -<a href="../files/lib/quarry/mockery_rb.html">lib/quarry/mockery.rb</a> - </td> - </tr> - </table> - </td> +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Module</strong></td> + <td class="class-name-in-header">Quarry</td> </tr> - </table> - <!-- banner header --> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../files/lib/quarry/spec/config_rb.html"> + lib/quarry/spec/config.rb + </a> + <br /> + <a href="../files/lib/quarry/spec/runner_rb.html"> + lib/quarry/spec/runner.rb + </a> + <br /> + <a href="../files/lib/quarry/spec/markup_rb.html"> + lib/quarry/spec/markup.rb + </a> + <br /> + <a href="../files/lib/quarry/spec/step_rb.html"> + lib/quarry/spec/step.rb + </a> + <br /> + <a href="../files/lib/quarry/spec/reporter/verbatim_rb.html"> + lib/quarry/spec/reporter/verbatim.rb + </a> + <br /> + <a href="../files/lib/quarry/spec/reporter/dotprogress_rb.html"> + lib/quarry/spec/reporter/dotprogress.rb + </a> + <br /> + <a href="../files/lib/quarry/spec/reporter/summary_rb.html"> + lib/quarry/spec/reporter/summary.rb + </a> + <br /> + <a href="../files/lib/quarry/spec/reporter_rb.html"> + lib/quarry/spec/reporter.rb + </a> + <br /> + <a href="../files/lib/quarry/spec/document_rb.html"> + lib/quarry/spec/document.rb + </a> + <br /> + <a href="../files/lib/quarry/spec/context_rb.html"> + lib/quarry/spec/context.rb + </a> + <br /> + <a href="../files/lib/quarry/break_rb.html"> + lib/quarry/break.rb + </a> + <br /> + <a href="../files/lib/quarry/extract_rb.html"> + lib/quarry/extract.rb + </a> + <br /> + <a href="../files/lib/quarry/stub/probe_rb.html"> + lib/quarry/stub/probe.rb + </a> + <br /> + <a href="../files/lib/quarry/stub/stub_rb.html"> + lib/quarry/stub/stub.rb + </a> + <br /> + <a href="../files/lib/quarry/stub/mock_rb.html"> + lib/quarry/stub/mock.rb + </a> + <br /> + <a href="../files/bin/quarry.html"> + bin/quarry + </a> + <br /> + </td> + </tr> + </table> + </div> + <!-- banner header --> + <div id="bodyContent"> - <div id="content"> + <div id="contextContent"> - <div class="sectiontitle">Methods</div> - <ul> - <li><a href="#M000011">Mockery</a></li> - </ul> + </div> - <div class="sectiontitle">Classes and Modules</div> - Module <a href="Quarry/Design.html" class="link">Quarry::Design</a><br /> -Module <a href="Quarry/Mock.html" class="link">Quarry::Mock</a><br /> -Class <a href="Quarry/MethodProbe.html" class="link">Quarry::MethodProbe</a><br /> + </div> + <!-- if includes --> -<div class="sectiontitle">Public Instance methods</div> -<div class="method"> - <div class="title"> - <a name="M000011"></a><b>Mockery</b>( realclass ) - </div> - <div class="description"> - <p> -Factory method for creating semi-functional mock object classes given the -class which is to be mocked. It looks like a constant for purposes of -syntactic sugar. -</p> - </div> -<div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000011_source')" id="l_M000011_source">show source</a> ]</p> - <div id="M000011_source" class="dyn-source"> -<pre> -<span class="ruby-comment cmt"># File lib/quarry/mockery.rb, line 25</span> - <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Mockery</span>( <span class="ruby-identifier">realclass</span> ) + <div id="section"> - <span class="ruby-identifier">mockclass</span> = <span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>( <span class="ruby-constant">Mock</span> ) + <div id="class-list"> + <h3 class="section-bar">Classes and Modules</h3> - <span class="ruby-identifier">mockclass</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span> <span class="ruby-ivar">@mocked_class</span> = <span class="ruby-identifier">realclass</span> <span class="ruby-keyword kw">end</span> + Module <a href="Quarry/Extract.html" class="link">Quarry::Extract</a><br /> +Class <a href="Quarry/Break.html" class="link">Quarry::Break</a><br /> +Class <a href="Quarry/Command.html" class="link">Quarry::Command</a><br /> +Class <a href="Quarry/MethodProbe.html" class="link">Quarry::MethodProbe</a><br /> +Class <a href="Quarry/Mock.html" class="link">Quarry::Mock</a><br /> +Class <a href="Quarry/Stub.html" class="link">Quarry::Stub</a><br /> - <span class="ruby-comment cmt"># Provide an accessor to class instance var that holds the class</span> - <span class="ruby-comment cmt"># object we're faking</span> - <span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">mockclass</span> - <span class="ruby-comment cmt"># The actual class being mocked</span> - <span class="ruby-identifier">attr_reader</span> <span class="ruby-identifier">:mocked_class</span> + </div> - <span class="ruby-comment cmt"># Propagate the mocked class ivar to derivatives so it can be</span> - <span class="ruby-comment cmt"># called like:</span> - <span class="ruby-comment cmt"># class MockFoo &lt; Mock( RealClass )</span> - <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inherited</span>( <span class="ruby-identifier">subclass</span> ) - <span class="ruby-identifier">mc</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mockedClass</span> - <span class="ruby-identifier">subclass</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span> <span class="ruby-ivar">@mocked_class</span> = <span class="ruby-identifier">mc</span> <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-comment cmt"># Build method definitions for all the mocked class's instance</span> - <span class="ruby-comment cmt"># methods, as well as those given to it by its superclasses, since</span> - <span class="ruby-comment cmt"># we're not really inheriting from it.</span> - <span class="ruby-identifier">imethods</span> = <span class="ruby-identifier">realclass</span>.<span class="ruby-identifier">instance_methods</span>(<span class="ruby-keyword kw">true</span>).<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> - <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-operator">::</span><span class="ruby-constant">Mock</span><span class="ruby-operator">::</span><span class="ruby-constant">UnmockedMethods</span> - <span class="ruby-comment cmt"># Figure out the argument list</span> - <span class="ruby-identifier">arity</span> = <span class="ruby-identifier">realclass</span>.<span class="ruby-identifier">instance_method</span>( <span class="ruby-identifier">name</span> ).<span class="ruby-identifier">arity</span> - <span class="ruby-identifier">optargs</span> = <span class="ruby-keyword kw">false</span> - <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arity</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> - <span class="ruby-identifier">optargs</span> = <span class="ruby-keyword kw">true</span> - <span class="ruby-identifier">arity</span> = (<span class="ruby-identifier">arity</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>).<span class="ruby-identifier">abs</span> - <span class="ruby-keyword kw">end</span> + - <span class="ruby-identifier">args</span> = [] - <span class="ruby-identifier">arity</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;arg#{n+1}&quot;</span> <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;*optargs&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">optargs</span> - <span class="ruby-comment cmt"># Build a method definition. Some methods need special</span> - <span class="ruby-comment cmt"># declarations.</span> - <span class="ruby-identifier">argsj</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">','</span>) - <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">intern</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:initialize</span> - <span class="ruby-node">&quot;def initialize(#{argsj}) ; super ; end&quot;</span> - <span class="ruby-keyword kw">else</span> - <span class="ruby-node">&quot;def #{name}(#{argsj}) ; self.send(#{name},#{argsj}) ; end&quot;</span> - <span class="ruby-comment cmt">#&quot;def %s( %s ) ; self.__mockRegisterCall(%s) ; end&quot; %</span> - <span class="ruby-comment cmt"># [ name, argstr, [&quot;:#{name}&quot;, *args].join(',') ]</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">end</span> + <!-- if method_list --> - <span class="ruby-comment cmt"># Now add the instance methods to the mockclass class</span> - <span class="ruby-identifier">mockclass</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-identifier">imethods</span>.<span class="ruby-identifier">join</span>( <span class="ruby-value str">&quot;\n&quot;</span> ) - <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">mockclass</span> - <span class="ruby-keyword kw">end</span> -</pre> </div> -</div> -</div> -</div> - </div> - </body> +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> </html> \ No newline at end of file