how to render a partial for test?

Railists:

This snip works inside an index.rhtml.

<%= render :partial => 'chat/index',
                    :locals => { :panel_id => 1 }
%>

Pretend for a moment that I know nothing about Rails. (:slight_smile:

How do I write a test case that renders a partial and puts the result
where goodies like assert_select can get into it?

This snip works inside an index.rhtml.

<%= render :partial => 'chat/index',
                    :locals => { :panel_id => 1 }
%>

I now need an answer to a bigger problem. (Apologies for it's
impossible to Google for, because 'xml' will give too many false hits.)

Suppose I wanted to concoct an HTML page using an RXML template,
because the source is so much cleaner and easier to refactor.

When that chat/index is an RXML, something in the rendering system
drops the Content-type: html/text from the outbound rendered contents.

This truly sucks, because I can no longer use "convention over
configuration". I have to put my XmlMarkup stuff into a function and
call it the old-fashioned way.

Oh, but now it's easier to test as a partial... :wink:

Use Test::Rails, part of ZenTest.

http://zentest.rubyforge.org/ZenTest/

- rob