hello there,<br><br>i have been trying my hand at this rbehave material, specifically in terms of integration testing a rails application, and i am curious about the most friendly way to deal with session data.<br><br>currently, the only way i have found to simulate a session is to open a session and refer to everything afterward via the @session variable stored after open_session. it seems to be workable, but is far from ideal:
<br><br><tt>dir = File.dirname(__FILE__)</tt><br>
<tt>require &#39;rubygems&#39;</tt><br>
<tt>require &#39;spec/story&#39;</tt><br>
<tt>require &quot;#{dir}/helper&quot;</tt><br>
<br>
<tt>steps_for(:dealer_login) do</tt><br>
<tt>&nbsp;&nbsp;&nbsp; Given(&quot;I have opened a session&quot;) do</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @session = open_session</tt><tt></tt><br>
<tt>&nbsp;&nbsp;&nbsp; end</tt><br>
<br>
<tt>&nbsp;&nbsp;&nbsp; Given(&quot;I am not logged in&quot;) do</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @session.instance_variable_get(&quot;@session&quot;).should == nil</tt><br>
<tt>&nbsp;&nbsp;&nbsp; end</tt><br>
<br>
<tt>&nbsp;&nbsp;&nbsp; Given(&quot;I have a valid login/password combo&quot;) do</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @login_with = valid_dealer_credentials</tt><br>
<tt>&nbsp;&nbsp;&nbsp; end</tt><br>
<br>
<tt>&nbsp;&nbsp;&nbsp; When(&quot;I submit my login/ password&quot;) do</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @session.post(&quot;/gateway&quot;, :user=&gt; @login_with)</tt><br>
<tt>&nbsp;&nbsp;&nbsp; end</tt><br>
<br>#there has to be a better way to address this<br>
<tt>&nbsp;&nbsp;&nbsp; Then(&quot;I should be authenticated&quot;) do</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @session.response.session.data.should == {:id =&gt; </tt><tt>1, &quot;flash&quot; =&gt; {}}</tt><br>
<tt>&nbsp;&nbsp;&nbsp; end</tt><br>
<br>#and this is just hideous. <br>
<tt>&nbsp;&nbsp;&nbsp; Then(&quot;I should be sent to the dealer landing page&quot;) do</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; puts @session.response.instance_variable_get</tt><tt>(&quot;@redirected_to&quot;).should == {:controller =&gt; &quot;dealers&quot;}</tt><br>
<tt>&nbsp;&nbsp;&nbsp; end</tt><br>
<tt>end</tt><br>
<br>
<tt>with_steps_for(:dealer_login) do</tt><br>
<tt>&nbsp;&nbsp;&nbsp; run_local_story &quot;dealer_story&quot;, :type=&gt;RailsStory</tt><br>
<tt>end</tt>
<br><br>there is a good chance someone has already covered this and i have just managed to miss it. documentation on rbehave is sparse (at best, as i have seen it. i have the peepcode, but if anyone has any other good resources i would be more than appreciative.)
<br><br>in the event that this has not been addressed, i see two possibilities:<br><br>first, that i am somehow subverting the intention of rbehave. as i understand it, however, rbehave is at least partially intended for integration-level specification, so it seems to me that this session information would be valuable.
<br><br>on the other hand, perhaps this needs to be addressed in some way. i would be happy to help, but i am interested to see the community&#39;s opinion on the issue first.<br><br>regards,<br>evan<br><br>