Re: [rspec-users] Problems with form_for and partials

2008-03-14 Thread Jonathan Linowes
seems like it'd make sense to just add this to http://code.google.com/ p/rspec-on-rails-matchers/ linoj On Mar 14, 2008, at 8:48 AM, Brandon Keepers wrote: Zach, On 3/14/08, Zach Moazeni <[EMAIL PROTECTED]> wrote: This hints at another extension I've wanted to write for us for a while. C

Re: [rspec-users] Problems with form_for and partials

2008-03-14 Thread Zach Dennis
tracting up one would make our specs more readable. > > Damn "To Code" list... > > -Zach > > Begin forwarded message: > > From: Zach Moazeni <[EMAIL PROTECTED]> > Date: March 13, 2008 1:46:34 PM GMT-04:00 > To: rspec-users > Subject: Re: [rspec-users] Pr

Re: [rspec-users] Problems with form_for and partials

2008-03-14 Thread Brandon Keepers
Zach, On 3/14/08, Zach Moazeni <[EMAIL PROTECTED]> wrote: > > This hints at another extension I've wanted to write for us for a while. > Common html selector strings, Labels, input fields, textareas, forms, > links, etc > > Really just rolling up something like: > > response.shouldhave_tag("input[

Re: [rspec-users] Problems with form_for and partials

2008-03-14 Thread Zach Moazeni
electors than abstracting up one would make our specs more readable. Damn "To Code" list... -Zach Begin forwarded message: From: Zach Moazeni <[EMAIL PROTECTED]> Date: March 13, 2008 1:46:34 PM GMT-04:00 To: rspec-users Subject: Re: [rspec-users] Problems with form_for and partials

Re: [rspec-users] Problems with form_for and partials

2008-03-13 Thread Zach Moazeni
We've been going down this route: http://pastie.caboo.se/165265 We use mocha for our mocking and originally we mocked out the form builder, but the specs felt crufty. We then converted to instantiating the FormBuilder and passing it to partials that needed it. For the views that send in th

Re: [rspec-users] Problems with form_for and partials

2008-03-13 Thread Jonathan Linowes
Thank you! for the record, I refactored my code so the view does a form_for, and any partials that render fields with the form builder does its own fields_for. This makes the design cleaner and more testable. However, I'm not sure if there's any performance cost in doing it this way instea

Re: [rspec-users] Problems with form_for and partials

2008-03-13 Thread David Chelimsky
On Wed, Mar 12, 2008 at 10:19 PM, Jonathan Linowes <[EMAIL PROTECTED]> wrote: > > On Mar 12, 2008, at 5:47 PM, David Chelimsky wrote: > > > 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 > >> yo

Re: [rspec-users] Problems with form_for and partials

2008-03-12 Thread Jonathan Linowes
On Mar 12, 2008, at 5:47 PM, David Chelimsky wrote: > 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" >> param

Re: [rspec-users] Problems with form_for and partials

2008-03-12 Thread David Chelimsky
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. >

Re: [rspec-users] Problems with form_for and partials

2008-03-12 Thread Zach Dennis
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,

Re: [rspec-users] Problems with form_for and partials

2008-03-12 Thread Jonathan Linowes
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 re

Re: [rspec-users] Problems with form_for and partials

2007-10-21 Thread rupert
> 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| -%> > <

Re: [rspec-users] Problems with form_for and partials

2007-10-20 Thread Russell Norris
David, thanks for that code. I was thinking of something like that myself. As for the form_for stuff, problem B solved itself when I created the form builder with its arguments in the correct order, heh. Problem A is much bigger and harder as the mock form builder i make creates a wholly different

Re: [rspec-users] Problems with form_for and partials

2007-10-20 Thread David Chelimsky
On 10/20/07, Russell Norris <[EMAIL PROTECTED]> 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 > > # a

[rspec-users] Problems with form_for and partials

2007-10-20 Thread Russell Norris
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 :part