It unfortunately access the wrong parameters. Instead of accessing the parameters from my url request, it access the parameters from my render_component.<br><br>For example, my request is<br><i><a href="http://localhost:4000/search/results?author=&keyword=&page=1&publisher=&title=agile">http://localhost:4000/search/results?author=&keyword=&page=1&publisher=&title=agile</a></i><br>
<br>In that results view, I render this component<br><i><%= render_component :controller => "components", :action => "footer", :params => { :lang => @language } %></i><br><br>So in the footer component, when I execute<br>
<i><% request.params.each do |param| %></i><br>it goes through the params from <i><a href="http://localhost:4000/search/results?author=&keyword=&page=1&publisher=&title=agile">http://localhost:4000/search/results?author=&keyword=&page=1&publisher=&title=agile</a><br>
<br></i>But if I execute<br><i><% params.each do |param| %><br></i>it goes through the params from <i><%= render_component :controller => "components", :action => "footer", :params => { :lang => @language } %><br>
<br></i>My test passes when I use only <i>params.each</i> but not when I use <i>request.params.each<br><br></i>Thanks again<br><br>Olivier Dupuis<br><br><div class="gmail_quote">On Fri, Apr 11, 2008 at 4:05 PM, David Chelimsky <<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style=""><div><div><div></div><div class="Wj3C7c">On Apr 11, 2008, at 3:53 PM, Olivier Dupuis wrote:<br>
<blockquote type="cite">Sorry about that. Here goes...<br><br>Spec:<br><br><i>describe "/search/index" do <br> it "should have option to login" do<br> render "/search/index"<br> response.should have_text(/Login/)<br>
end<br>end</i><br><br>Code for index.rhtml<br><br><i><body> <br> <div id="container"> <br> <div id="main_footer" align="center"><br> <%= render_component :controller => "components", :action => "footer", :params => { :lang => @language } %> <br>
</div><br> </div><br></body></i><br><br>Code for footer.rhtml<br><br><i><% listOfParameters = "" %><br><% request.params.each do |param| %><br> <% if param[0].to_s != "lang" %><br>
<% listOfParameters = listOfParameters + "&" + param[0].to_s + "=" + param[1].to_s %><br> <% end %><br><% end %><br><br>...</i><br><br>Now the error message:<br><br><i>ActionView::TemplateError in '/search/index should have option to login'<br>
undefined method 'params' for #<ActionController::TestRequest:0x46a044c><br>On line #7 of app/views/components/footer.rhtml<br><br></i><i>6: <% listOfParameters = "" %><br>7: <% request.params.each do |param| %></i></blockquote>
<div><br></div></div></div><div>Try just params (not request.params) - does that work?</div><div><div></div><div class="Wj3C7c"><br><blockquote type="cite"><i><br> 8: <% if param[0].to_s != "lang" %><br>
9: <% listOfParameters = listOfParameters + "&" + param[0].to_s + "=" + param[1].to_s %><br>10: <% end %><br>11: <% end %><br> <br><br></i>Thanks again<br><br>Olivier Dupuis<br>
<br><br><div class="gmail_quote">On Fri, Apr 11, 2008 at 3:26 PM, David Chelimsky <<a href="mailto:dchelimsky@gmail.com" target="_blank">dchelimsky@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Please post spec, code and error message.<br> <div><div></div><div><br> On Apr 11, 2008, at 3:21 PM, Olivier Dupuis wrote:<br> <br> > Hello,<br> ><br> > I have a rhtml file that goes through the request.params. One of my<br>
> test generates that file, but rspec pops an error saying :<br> ><br> > undefined method 'params' for ...<br> ><br> > I'm not sure what to do with this, since request.params actually<br> > works with rails.<br>
><br> > Any idea?<br> ><br> > Thank you<br> ><br> > Olivier Dupuis<br> </div></div>> _______________________________________________<br> > rspec-users mailing list<br> > <a href="mailto:rspec-users@rubyforge.org" target="_blank">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> <br> _______________________________________________<br> rspec-users mailing list<br>
<a href="mailto:rspec-users@rubyforge.org" target="_blank">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>
</blockquote></div><br> _______________________________________________<br>rspec-users mailing list<br><a href="mailto:rspec-users@rubyforge.org" target="_blank">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></blockquote>
</div></div></div><br></div><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/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br></blockquote></div><br>