On Wed, Mar 12, 2008 at 9:43 PM, Zach Dennis <[EMAIL PROTECTED]> wrote: > You can use mocha parameter matching to match on "anything" where your > form builder would be passed in. You could also use Mocha's "kind_of" > parameter matcher to ensure that what you expect is a FormBuilder > object. > > Another way to do this is to not pass in your form builder, but the > object needed, and then use fields_for inside the partial itself. This > works well in some scenarios.
You could also use rspec's parameter matching, which also supports "anything" but not "kind_of" ;) > > Zach > > > > On Wed, Mar 12, 2008 at 4:24 PM, Jonathan Linowes > <[EMAIL PROTECTED]> wrote: > > Has anyone come up with a solution for stubbing partials and passing > > form builders to it? > > i have a complex form with many parts, and those are rendered in > > partials > > > > > > > > > > On Oct 21, 2007, at 8:46 AM, rupert wrote: > > > > >> i'm having problem with a form_for situation where i'm trying to DRY > > >> out the repeated parts of my forms and put them in common/form and > > >> render the form elements via another partial in controller_name/ > > >> _form. > > >> Here's the first form > > >> > > >> # app/views/common/form > > >> <% form_for ... do |f| -%> > > >> <%= render :partial => "params[:controller]/form", :object => f %> > > >> <p>Submit buttons...</p> > > >> <% end -%> > > > > > > I had exactly the same problem and ending up putting the > > > > > > form_for ...do |f| > > > > > > in the partial so I didn't have to pass form builders around. This > > > won't be practical though if you are using multiple partials for your > > > forms fields. > > > > > > Rupert > > > > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users@rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users@rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > Zach Dennis > http://www.continuousthinking.com > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users