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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to