I've wrestled with the same problem. I first render one of several templates to a string, then include the string within a rendered template. And my testing breaks (or at least is counter-intuitive) as well.
It certainly doesn't seem right that rendering to a string dominates (assert_template-wise) the rendering of a template for CGI. And it also doesn't seem right that the first render action dominates the last render action. Anybody got a good explanation for this strange behavior? -Chris On Jun 13, 7:20 pm, "Andrew Kaspick" <[EMAIL PROTECTED]> wrote: > Hello, > > In actionpack/lib/action_controller/test_process.rb > > Why does the following method, use the first rendered file and not the last? > > # returns the template path of the file which was used to > # render this response (or nil) > def rendered_file(with_controller=false) > unless template.first_render.nil? > unless with_controller > template.first_render > else > template.first_render.split('/').last || template.first_render > end > end > end > > Currently I'm using assert_template which calls this method and I do > a render_to_string in the action I'm testing before the actions view > is rendered, so assert_template is saying the template that's being > rendered is the one from render_to_string, which is not what I want. > Is it looking at the first rendered file because the last file could > be a partial rendered in the view for example? > > eg. > > def my_action > @code = render_to_string :partial => 'blah' > render :action => 'other_action' > end > > assert_template says the rendered template is 'blah' and not 'other_action'. > > Is this a bug in assert_template? I would think it should ignore the > file being rendered from render_to_string. > > Thanks, > Andrew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---