title: testing (rspec) nested model partials in rails 2.3+
body: <p>With the 2.3.x+ rails feature of nested models, I think I need to have access to a form builder instance to properly spec partials for rendering the nested models. Pulling from the complex-forms-examples:</p>
  
  <p>For example, here is an enclosing form that creates and passes the form builder to the nested model rendering view:</p>
  
  <pre><code>&lt;div class="children_fields tasks" id="&lt;%= dom_id(f.object) %&gt;_tasks"  
     data-context="&lt;%= f.object_name %&gt;"&gt;
    &lt;% f.fields_for :tasks do |task_form| %&gt;
      &lt;%= render :partial =&gt; 'task', :locals =&gt; { :f =&gt; task_form } %&gt;
    &lt;% end %&gt;    
  &lt;/div&gt;
  </code></pre>
  
  <p>The task partial is:</p>
  
  <pre><code>&lt;%= f.label :name, "Task" %&gt;
  &lt;%= f.text_field :name %&gt;
  &lt;%= remove_child_link "remove", '#', f %&gt;
  &lt;div class="children_fields assignments" id="&lt;%= dom_id(f.object) %&gt;_assignments"  
       data-context="&lt;%= f.object_name %&gt;"&gt;
    &lt;% f.fields_for :assignments do |assignment_form| %&gt;
      &lt;%= render :partial =&gt; 'assignment', :locals =&gt; { :f =&gt; assignment_form } %&gt;
    &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I try to spec a partial like this, I tried to catch the form builder as an instance var by doing:</p>
  
  <pre><code>before(:each) do
    ... # setup for target object
    form_for [:foo, :bar, @project] do |f|
      @f = f
    end
  end
  </code></pre>
  
  <p>This raises an error on the use of form_for</p>
  
  <pre><code>undefined method `polymorphic_path' for #&lt;Spec::Rails::Example::ViewExampleGroup::Subclass_1:0x2cfeafc&gt;
  /Users/adamaig/.rvm/gems/ruby/1.8.7/gems/actionpack-2.3.5/lib/action_controller/test_process.rb:511:in `method_missing'
  /Users/adamaig/.rvm/gems/ruby/1.8.7/gems/actionpack-2.3.5/lib/action_view/helpers/form_helper.rb:298:in `apply_form_for_options!'
  /Users/adamaig/.rvm/gems/ruby/1.8.7/gems/actionpack-2.3.5/lib/action_view/helpers/form_helper.rb:272:in `form_for'
  </code></pre>
  
  <p>So, What is the right way to:
  1) get a FormBuilder instance for specs like this?
  2) spec nested models and their view forms?</p>
  
  <p>This matters for the proper name generation.</p>