<div>&nbsp;&nbsp; &nbsp;get :show, :writer_id =&gt; &quot;1&quot;, :note_id =&gt; &quot;1&quot;</div><div><br class="webkit-block-placeholder"></div><div>This may also&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>&nbsp;&nbsp; &nbsp;get :show, :writer_id =&gt; &quot;1&quot;, :id =&gt; &quot;1&quot;
</div><br><div><span class="gmail_quote">On 9/22/07, <b class="gmail_sendername">David Chelimsky</b> &lt;<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
Controller specs are similar to Rails functional tests, except that<br>they don&#39;t render views (unless you tell them to). So rather than<br>saying:<br><br>get notes_path(1,1)<br><br>you want to say:<br><br>get :show, :writer_id =&gt; &quot;1&quot;, :note_id =&gt; &quot;1&quot;
<br><br>Give that a shot and let us know if it works out.<br><br>Cheers,<br>David<br><br>On 9/14/07, Andreas Wolff &lt;<a href="mailto:thinkdiv@googlemail.com">thinkdiv@googlemail.com</a>&gt; wrote:<br>&gt; Hey everyone.<br>
&gt; I really stuck on testing a nested controller. I&#39;m trying to make a<br>&gt; request using get and afterwards checking the response by<br>&gt; response.should ...<br>&gt;<br>&gt; My routes.rb looks like this:<br>&gt;
<br>&gt; map.resources :writers do |writers|<br>&gt;&nbsp;&nbsp; writers.resources :notes<br>&gt; end<br>&gt;<br>&gt;<br>&gt; In my notes_controller_spec.rb<br>&gt;<br>&gt; def do_get<br>&gt;&nbsp;&nbsp; writer_id = 1<br>&gt;&nbsp;&nbsp; note_id = 1<br>
&gt;&nbsp;&nbsp; get note_path(writer_id, note_id)<br>&gt; end<br>&gt;<br>&gt; it &quot;should show a note&quot; do<br>&gt;&nbsp;&nbsp; do_get<br>&gt;&nbsp;&nbsp; response.should be_success<br>&gt; end<br>&gt;<br>&gt;<br>&gt; But this always ends in an error message:
<br>&gt; You have a nil object when you didn&#39;t expect it!<br>&gt; The error occurred while evaluating nil.rewrite<br>&gt;<br>&gt; Can anybody help here??<br>&gt;<br>&gt; --<br>&gt; by(e)<br>&gt; Andreas Wolff<br>&gt; ______________________________
_________________<br>&gt; rspec-users mailing list<br>&gt; <a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>&gt; <a href="http://rubyforge.org/mailman">http://rubyforge.org/mailman</a>/listinfo/rspec-users
<br>&gt;<br>_______________________________________________<br>rspec-users mailing list<br><a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman">http://rubyforge.org/mailman
</a>/listinfo/rspec-users<br></blockquote></div><br>