<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:garamond,new york,times,serif;font-size:12pt">Going back to my original message, I have the following at the beginning of the download method:<br><br>&nbsp;  def download<br>&nbsp;&nbsp; @orders = Order.find( params[:ids] )<br>&nbsp;&nbsp; ...<br><br>The problem is that params[:ids], although built as an Array object by the view that calls the download method on the controller, is passed as a /-delimited string of id values.&nbsp; Order.find() will not do the desired thing with that string, which was intended to be an array by the view, but Rails passed it in a string representation.&nbsp; So the method really should be<br><br>&nbsp;  def download<br>
&nbsp;&nbsp; @orders = Order.find( params[:ids].split( '/' ) )<br>
<br>and what I'm trying to spec is the addition of the call to split().<br><br><br>Al<div><div style="font-family: garamond,new york,times,serif; font-size: 12pt;"><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Jarkko Laine &lt;jarkko@jlaine.net&gt;<br>To: rspec-users &lt;rspec-users@rubyforge.org&gt;<br>Sent: Tuesday, December 4, 2007 7:31:11 AM<br>Subject: Re: [rspec-users] params not available for controller specs?<br><br>
On 4.12.2007, at 17.13, Al Chou wrote:<br><br>&gt; Ah, thanks!&nbsp; That was a breakthrough.&nbsp; My mock object "ids_string"&nbsp; <br>&gt; isn't receiving the method calls I expect (even though the code&nbsp; <br>&gt; under test actually does what I want it to do and works correctly),&nbsp; <br>&gt; but at least I'm past the params issue.<br><br>You don't get the same object through the action queue, which is&nbsp; <br>another reason for not mocking something there. "string 1" is not&nbsp; <br>necessarily the same object as "string 1"&nbsp; and Rails will do a lot of&nbsp; <br>processing to the parameters before they end up in the params hash.<br><br>Just assume that a similar string will get passed through and spec&nbsp; <br>that the behaviour is what you expect.<br><br>What kind of method calls are you expecting/stubbing for a string?<br><br>//jarkko<br><br>--<br>Jarkko Laine<br><a href="http://jlaine.net"
 target="_blank">http://jlaine.net</a><br><a href="http://dotherightthing.com" target="_blank">http://dotherightthing.com</a><br><a href="http://www.railsecommerce.com" target="_blank">http://www.railsecommerce.com</a><br><a href="http://odesign.fi" target="_blank">http://odesign.fi</a><br><br><br>_______________________________________________<br>rspec-users mailing list<br><a ymailto="mailto:rspec-users@rubyforge.org" href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br></div><br></div></div></div><br>

      <hr size=1>Never miss a thing.  <a href="http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs"> Make Yahoo your homepage.</a>

</body></html>