<div> get :show, :writer_id => "1", :note_id => "1"</div><div><br class="webkit-block-placeholder"></div><div>This may also </div><div><br class="webkit-block-placeholder"></div><div> get :show, :writer_id => "1", :id => "1"
</div><br><div><span class="gmail_quote">On 9/22/07, <b class="gmail_sendername">David Chelimsky</b> <<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>> 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'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 => "1", :note_id => "1"
<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 <<a href="mailto:thinkdiv@googlemail.com">thinkdiv@googlemail.com</a>> wrote:<br>> Hey everyone.<br>
> I really stuck on testing a nested controller. I'm trying to make a<br>> request using get and afterwards checking the response by<br>> response.should ...<br>><br>> My routes.rb looks like this:<br>>
<br>> map.resources :writers do |writers|<br>> writers.resources :notes<br>> end<br>><br>><br>> In my notes_controller_spec.rb<br>><br>> def do_get<br>> writer_id = 1<br>> note_id = 1<br>
> get note_path(writer_id, note_id)<br>> end<br>><br>> it "should show a note" do<br>> do_get<br>> response.should be_success<br>> end<br>><br>><br>> But this always ends in an error message:
<br>> You have a nil object when you didn't expect it!<br>> The error occurred while evaluating nil.rewrite<br>><br>> Can anybody help here??<br>><br>> --<br>> by(e)<br>> Andreas Wolff<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>><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>