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| %>
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
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users