    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>vaporbase :: Getting Started with Story Runner</title>
        <link>http://www.vaporbase.com/</link>
        <description>the knowledge base that almost is</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Vaporbase Admin</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:admin@parkerhill.com" /> 
       <sy:updatePeriod>hourly</sy:updatePeriod> 
       <sy:updateFrequency>1</sy:updateFrequency> 
       <docs>http://backend.userland.com/rss</docs>

<!-- show a header for the current publication type -->
        <h2>Postings</h2>


<div class="xar-mod-head"><span class="xar-mod-title">rails</span></div>

<table border="0" cellpadding="1" cellspacing="0">
<tr>
    <td valign="top">
        Browse in :
   </td>
   <td valign="top">

                                    <a href="http://www.vaporbase.com/postings/">All</a>

                 &gt;                     <a href="http://www.vaporbase.com/postings/c36/">subjects</a>

                 &gt;                     <a href="http://www.vaporbase.com/postings/c42/">rails</a>
<br />
</td>
</tr>
</table>






<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xd</em>
and <em>user-summary-[publicationtype].xd</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles
The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Getting Started with Story Runner</h1>
<p><strong>Author:</strong>&nbsp;linoj</p>
<p>
<strong>Date:</strong> January 07, 2008 10:08:43 AM  or Mon, 07 January 2008 10:08:43 </p>
<p><strong>Summary:</strong>&nbsp;Here's a short how-to, cobbled together from various other articles, emails, and generous help on #rspec. Consider this a stop-gap until documentation is up on the Rspec site.</p>
<p><strong>Body:</strong>&nbsp;<h2>1. Decide a directory structure and fill out helper.rb<br /></h2><p>Presently there isn&#39;t a stories generator or established conventions for arranging your directories. I create a stories/ subfolder that contains subfolders for each set of features or parts of the site that I&#39;m storying.<br /><br />stories/<br />├─── steps/<br />│   └─── bar_steps.rb<br />├─── stories/<br />│   ├─── foo/<br />│   │  ├─── a_foo_story<br />│   │  ├─── a_foo_story.rb<br />│   │  ├─── another_foo_story<br />│   │  └─── another_foo_story.rb</p><p>├───  all.rb<br />└─── helper.rb<br /></p><p>The helper.rb file needs some help finding your stuff. Here&#39;s how I&#39;ve fleshed it out. </p><p><em>File: stories/helper.rb:</em><br /></p><pre>ENV[&quot;RAILS_ENV&quot;] = &quot;test&quot;<br />require File.expand_path(File.dirname(__FILE__) + &quot;/../config/environment&quot;)<br />require &#39;spec/rails/story_adapter&#39;</pre><pre>Dir[&#39;stories/steps/**/*.rb&#39;].each do |steps_file|<br />   require steps_file<br />end<br /><br /></pre><pre># add extra include&#39;s and helper methods here<br />include FixtureReplacement</pre><h2>2. Write a short text story</h2><p>This is just an example, of course. </p><p>File: stories/stories/users/a_user_logs_in<br /></p><pre>Story: a user logs in</pre><pre>    As a user on the site</pre><pre>    I log in</pre><pre>    So I can do cool stuff</pre><pre><br />Scenario: I log in and see a welcome message</pre><pre>    Given a registered user John</pre><pre>    When I log in as John</pre><pre>    Then the browser should show &quot;Welcome John!&quot;</pre><h2>3. Write an rb script for the story<br /></h2><p>File: stories/stories/users/a_user_logs_in.rb<br /></p><pre>require File.join(File.dirname(__FILE__), &quot;../../helper&quot;)</pre><pre><br />with_steps_for :misc do</pre><pre>   run File.expand_path(__FILE__).gsub(&quot;.rb&quot;,&quot;&quot;), :type =&gt; RailsStory</pre><pre>end<br /></pre><p>For other stories, just copy this file, and add/change the steps  <br />groups as required. The rest of the file is unchanged (it gets the  <br />text story filename from its own name.)<br /><br />And run it:<br /></p><pre>$ ruby stories/stories/users/a_user_logs_in.rb<br /></pre><p>should show 1 scenarios: 0 succeeded, 0 failed, 1 pending<br /></p><h2>4. Code the Steps<br /></h2><p>To start, I put all my steps into a &quot;miscellaneous&quot; steps file until  <br />patterns emerge when I&#39;ll separate them out into different steps files<br /><br />File: stores/steps/misc_steps.rb<br /></p><pre>steps_for(:misc) do</pre><pre>  Given &quot;a registered user $login&quot; do |login|</pre><pre>    @user = create_user( :login =&gt; login )</pre><pre>  end</pre><pre><br />  When &quot;I log in as $login&quot; do |login|</pre><pre>    post_via_redirect &#39;/login&#39;, :login =&gt; login, :password =&gt; &#39;secret&#39;</pre><pre>    response.should be_success</pre><pre>    session[:user].should == @user.id</pre><pre>  end</pre><pre><br />  Then &quot;the browser should show $text&quot; do |text|</pre><pre>    response.should have_text(text)</pre><pre>  end<br />end<br /></pre><p>And run it<br /></p><pre>$ ruby stories/stories/users/a_user_logs_in.rb<br /></pre><p>or<br /></p><pre>$ ruby stories/all.rb</pre><p>&nbsp;</p></p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
        <p>Last modified on Jan 15, 2008 8:38:42 PM by <a href="http://www.vaporbase.com/roles/3">linoj</a></p>
        <p>



<p>
There are no comments attached to this item.</p>
<script type="text/javascript" src="modules/base/xartemplates/includes/submitonce.js"></script>
  <h3>Post a new comment</h3> 
  <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" name="post" id="post" onSubmit="submitonce(this)" id="post"
 >
   <div class="xar-ib-wrapper xar-accent-outline">
<div class="xar-ib-actionpanel xar-accent">
         <span>
 BBCode Actions             : 
          </span>
          <span>
            <!-- New xaraya style link tag <xar:set name="$stylesheet">xarTplAddStyleLink('bbcode', 'bbcode')</xar:set> -->

<span>
    <input type="button" accesskey="z" name="addbbcode18" value=" p " onclick="bbstyle(18)" onmouseover="document.post.helpbox.value='Paragraph: [p]text[/p] (alt+z)'; return true" />
    <input type="button" accesskey="b" name="addbbcode0" value=" b " style="font-weight:bold;" onclick="bbstyle(0)" onmouseover="document.post.helpbox.value='Bold text: [b]text[/b] (alt+b)'; return true" />
    <input type="button" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic;" onclick="bbstyle(2)" onmouseover="document.post.helpbox.value='Italic text: [i]text[/i] (alt+i)'; return true" />
    <input type="button" accesskey="u" name="addbbcode4" value=" u " style="font-style: underline;" onclick="bbstyle(4)" onmouseover="document.post.helpbox.value='Underline text: [u]text[/u] (alt+u)'; return true" />
    <input type="button" accesskey="q" name="addbbcode6" value="Quote" onclick="bbstyle(6)" onmouseover="document.post.helpbox.value='Quote text: [quote]text[/quote] (alt+q)'; return true" />
    <input type="button" accesskey="c" name="addbbcode8" value="Code" onclick="bbstyle(8)" onmouseover="document.post.helpbox.value='Code display: [code=xml]code[/code] (alt+c)'; return true" />
    <input type="button" accesskey="p" name="addbbcode14" value="Img" onclick="bbstyle(14)" onmouseover="document.post.helpbox.value='Insert image: [img]http://image_url[/img] (alt+p)'; return true" />
    <input type="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline;" onclick="bbstyle(16)" onmouseover="document.post.helpbox.value='Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url] (alt+w)'; return true" />
</span>
<label for="addbbcode20">
 Font color     :
</label>
<select name="addbbcode20" onchange="bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onmouseover="document.post.helpbox.value='Font color: [color=red]text[/color] Tip: you can also use color=#FF0000'; return true">
   <option style="color:black; background-color: #FAFAFA" value="#444444" class="xar-bbcode-genmed">
 Default </option>
   <option style="color:darkred; background-color: #FAFAFA" value="darkred" class="xar-bbcode-genmed">
 Dark Red </option>
   <option style="color:red; background-color: #FAFAFA" value="red" class="xar-bbcode-genmed">
 Red </option>
   <option style="color:orange; background-color: #FAFAFA" value="orange" class="xar-bbcode-genmed">
 Orange </option>
   <option style="color:brown; background-color: #FAFAFA" value="brown" class="xar-bbcode-genmed">
 Brown </option>
   <option style="color:yellow; background-color: #FAFAFA" value="yellow" class="xar-bbcode-genmed">
 Yellow </option>
   <option style="color:green; background-color: #FAFAFA" value="green" class="xar-bbcode-genmed">
 Green </option>
   <option style="color:olive; background-color: #FAFAFA" value="olive" class="xar-bbcode-genmed">
 Olive </option>
   <option style="color:cyan; background-color: #FAFAFA" value="cyan" class="xar-bbcode-genmed">
 Cyan </option>
   <option style="color:blue; background-color: #FAFAFA" value="blue" class="xar-bbcode-genmed">
 Blue </option>
   <option style="color:darkblue; background-color: #FAFAFA" value="darkblue" class="xar-bbcode-genmed">
 Dark Blue </option>
   <option style="color:indigo; background-color: #FAFAFA" value="indigo" class="xar-bbcode-genmed">
 Indigo </option>
   <option style="color:violet; background-color: #FAFAFA" value="violet" class="xar-bbcode-genmed">
 Violet </option>
   <option style="color:white; background-color: #FAFAFA" value="white" class="xar-bbcode-genmed">
 White </option>
   <option style="color:black; background-color: #FAFAFA" value="black" class="xar-bbcode-genmed">
 Black </option>
</select>
<label for="addbbcode22">
 Font size     :
</label>
<select name="addbbcode22" onchange="bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onmouseover="document.post.helpbox.value='Font size: [size=x-small]small text[/size]'; return true">
   <option value="7" class="xar-bbcode-genmed">
 Tiny </option>
   <option value="9" class="xar-bbcode-genmed">
 Small </option>
   <option value="12" selected="selected" class="xar-bbcode-genmed">
 Normal </option>
   <option value="18" class="xar-bbcode-genmed">
 Large </option>
   <option value="24" class="xar-bbcode-genmed">
 Huge     </option>
</select>
<a href="javascript:bbstyle(-1)" class="xar-bbcode-genmed" onmouseover="document.post.helpbox.value='Close all open bbCode tags'; return true">Close Tags</a>
<span class="gensmall">
    <input type="text" name="helpbox" size="50" maxlength="100" class="helpline" value="Tip: Styles can be applied quickly to selected text." />
</span>         </span>
       </div>
       <div class="xar-ib-leftpanelshort">
         <p>
 Name :
              Anonymous</p>
         <label for="package-title">
 Title: </label>
            <input class="xar-ib-field" type="text" name="package[title]" id="package-title" value="Getting Started with Story Runner" tabindex="1" />
         <label for="package-text">
 Comment: </label>
<textarea class="xar-ib-fieldtext" name="package[text]" id="package-text" tabindex="2"></textarea>

          <input type="hidden" name="header[modid]" id="header-modid" value="151" /> 
          <input type="hidden" name="header[objectid]" id="header-objectid" value="155" /> 
          <input type="hidden" name="header[itemtype]" id="header-itemtype" value="9" />
<input type="hidden" name="header[pid]" id="header-pid" value="0" />
          <input type="hidden" name="receipt[returnurl][decoded]" id="receipt-returnurl-decoded" value="http://www.vaporbase.com/postings/Getting_Started_with_Story_Runner?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
          <!--<input type="hidden" name="receipt[returnurl][encoded]" id="receipt-returnurl-encoded" value="#$receipt['returnurl']['encoded']#" />-->
          <input type="hidden" name="receipt[action]" id="receipt-action" /> 
          <input type="submit" id="receipt-action-preview" onclick="document.getElementById('receipt-action').value='preview'" value="Preview" /> 
          <input type="submit" id="receipt-action-submit" onclick="document.getElementById('receipt-action').value='submit'" value="Submit" />
       </div>
</div>
 </form>
</p>
        <p></p>
        <p><br/>
<b>Keywords :</b>
<div style="margin-left: 1em; margin-right: 1em; text-align:left;">
    <li><a href="http://www.vaporbase.com/keywords/rspec/">rspec</a></li>
    <li><a href="http://www.vaporbase.com/keywords/story runner/">story runner</a></li>
</div>
<br/>

</p>
</div>
   </channel>
</rss>
