<?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: Spec::Story::StepGroup</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">Spec::Story::StepGroup</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/rspec/lib/spec/story/step_group_rb.html">
                vendor/plugins/rspec/lib/spec/story/step_group.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000608">&lt;&lt;</a>&nbsp;&nbsp;
      <a href="#M000597">Given</a>&nbsp;&nbsp;
      <a href="#M000596">GivenScenario</a>&nbsp;&nbsp;
      <a href="#M000599">Then</a>&nbsp;&nbsp;
      <a href="#M000598">When</a>&nbsp;&nbsp;
      <a href="#M000604">add</a>&nbsp;&nbsp;
      <a href="#M000607">add_to</a>&nbsp;&nbsp;
      <a href="#M000605">clear</a>&nbsp;&nbsp;
      <a href="#M000609">create_matcher</a>&nbsp;&nbsp;
      <a href="#M000606">empty?</a>&nbsp;&nbsp;
      <a href="#M000595">find</a>&nbsp;&nbsp;
      <a href="#M000601">given</a>&nbsp;&nbsp;
      <a href="#M000600">given_scenario</a>&nbsp;&nbsp;
      <a href="#M000594">new</a>&nbsp;&nbsp;
      <a href="#M000593">steps</a>&nbsp;&nbsp;
      <a href="#M000603">then</a>&nbsp;&nbsp;
      <a href="#M000602">when</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000594" class="method-detail">
        <a name="M000594"></a>

        <div class="method-heading">
          <a href="#M000594" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(init_defaults=true, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000594-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000594-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 19</span>
19:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">init_defaults</span>=<span class="ruby-keyword kw">true</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
20:         <span class="ruby-ivar">@hash_of_lists_of_steps</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = []}
21:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">init_defaults</span>
22:           <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">steps</span>.<span class="ruby-identifier">add_to</span>(<span class="ruby-keyword kw">self</span>)
23:         <span class="ruby-keyword kw">end</span>
24:         <span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
25:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000593" class="method-detail">
        <a name="M000593"></a>

        <div class="method-heading">
          <a href="#M000593" class="method-signature">
          <span class="method-name">steps</span><span class="method-args">(&amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000593-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000593-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 13</span>
13:       <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">steps</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
14:         <span class="ruby-ivar">@step_group</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">StepGroup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">false</span>)
15:         <span class="ruby-ivar">@step_group</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
16:         <span class="ruby-ivar">@step_group</span>
17:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000608" class="method-detail">
        <a name="M000608"></a>

        <div class="method-heading">
          <a href="#M000608" class="method-signature">
          <span class="method-name">&lt;&lt;</span><span class="method-args">(other_step_matchers)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000608-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000608-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 76</span>
76:       <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-identifier">other_step_matchers</span>)
77:         <span class="ruby-identifier">other_step_matchers</span>.<span class="ruby-identifier">add_to</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other_step_matchers</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:add_to</span>)
78:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000597" class="method-detail">
        <a name="M000597"></a>

        <div class="method-heading">
          <a href="#M000597" class="method-signature">
          <span class="method-name">Given</span><span class="method-args">(name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000597-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000597-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 38</span>
38:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Given</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
39:         <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">:given</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
40:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000596" class="method-detail">
        <a name="M000596"></a>

        <div class="method-heading">
          <a href="#M000596" class="method-signature">
          <span class="method-name">GivenScenario</span><span class="method-args">(name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000596-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000596-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 34</span>
34:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">GivenScenario</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
35:         <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">:given_scenario</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
36:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000599" class="method-detail">
        <a name="M000599"></a>

        <div class="method-heading">
          <a href="#M000599" class="method-signature">
          <span class="method-name">Then</span><span class="method-args">(name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000599-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000599-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 46</span>
46:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Then</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
47:         <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">:then</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
48:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000598" class="method-detail">
        <a name="M000598"></a>

        <div class="method-heading">
          <a href="#M000598" class="method-signature">
          <span class="method-name">When</span><span class="method-args">(name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000598-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000598-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 42</span>
42:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">When</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
43:         <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">:when</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
44:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000604" class="method-detail">
        <a name="M000604"></a>

        <div class="method-heading">
          <a href="#M000604" class="method-signature">
          <span class="method-name">add</span><span class="method-args">(type, steps)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000604-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000604-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 55</span>
55:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">steps</span>)
56:         (<span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">steps</span>).<span class="ruby-identifier">flatten!</span>
57:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000607" class="method-detail">
        <a name="M000607"></a>

        <div class="method-heading">
          <a href="#M000607" class="method-signature">
          <span class="method-name">add_to</span><span class="method-args">(other_step_matchers)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000607-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000607-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 70</span>
70:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_to</span>(<span class="ruby-identifier">other_step_matchers</span>)
71:         [<span class="ruby-identifier">:given_scenario</span>, <span class="ruby-identifier">:given</span>, <span class="ruby-identifier">:when</span>, <span class="ruby-identifier">:then</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
72:           <span class="ruby-identifier">other_step_matchers</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">type</span>, <span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>])
73:         <span class="ruby-keyword kw">end</span>
74:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000605" class="method-detail">
        <a name="M000605"></a>

        <div class="method-heading">
          <a href="#M000605" class="method-signature">
          <span class="method-name">clear</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000605-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000605-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 59</span>
59:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
60:         <span class="ruby-ivar">@hash_of_lists_of_steps</span>.<span class="ruby-identifier">clear</span>
61:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000609" class="method-detail">
        <a name="M000609"></a>

        <div class="method-heading">
          <a href="#M000609" class="method-signature">
          <span class="method-name">create_matcher</span><span class="method-args">(type, name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
TODO - make me private
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000609-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000609-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 81</span>
81:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
82:         <span class="ruby-identifier">matcher</span> = <span class="ruby-constant">Step</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
83:         <span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">matcher</span>
84:         <span class="ruby-identifier">matcher</span>
85:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000606" class="method-detail">
        <a name="M000606"></a>

        <div class="method-heading">
          <a href="#M000606" class="method-signature">
          <span class="method-name">empty?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000606-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000606-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 63</span>
63:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">empty?</span>
64:         [<span class="ruby-identifier">:given_scenario</span>, <span class="ruby-identifier">:given</span>, <span class="ruby-identifier">:when</span>, <span class="ruby-identifier">:then</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
65:           <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>].<span class="ruby-identifier">empty?</span>
66:         <span class="ruby-keyword kw">end</span>
67:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
68:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000595" class="method-detail">
        <a name="M000595"></a>

        <div class="method-heading">
          <a href="#M000595" class="method-signature">
          <span class="method-name">find</span><span class="method-args">(type, name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000595-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000595-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 27</span>
27:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">name</span>)
28:         <span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">step</span><span class="ruby-operator">|</span>
29:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">step</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">step</span>.<span class="ruby-identifier">matches?</span>(<span class="ruby-identifier">name</span>)
30:         <span class="ruby-keyword kw">end</span>
31:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
32:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000601" class="method-detail">
        <a name="M000601"></a>

        <div class="method-heading">
          <span class="method-name">given</span><span class="method-args">(name, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="StepGroup.html#M000597">Given</a>
</p>
        </div>
      </div>

      <div id="method-M000600" class="method-detail">
        <a name="M000600"></a>

        <div class="method-heading">
          <span class="method-name">given_scenario</span><span class="method-args">(name, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="StepGroup.html#M000596">GivenScenario</a>
</p>
        </div>
      </div>

      <div id="method-M000603" class="method-detail">
        <a name="M000603"></a>

        <div class="method-heading">
          <span class="method-name">then</span><span class="method-args">(name, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="StepGroup.html#M000599">Then</a>
</p>
        </div>
      </div>

      <div id="method-M000602" class="method-detail">
        <a name="M000602"></a>

        <div class="method-heading">
          <span class="method-name">when</span><span class="method-args">(name, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="StepGroup.html#M000598">When</a>
</p>
        </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>