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