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 > >> 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" ;) > > how would i use that in stub_render? eg if my view has > <%= render :partial => 'pages/foo', :layout => 'bar', :locals => > { :f => f } %> > > what's the stub?
As of 1.1.3: stub_render(:partial => 'pages/foo', :layout => 'bar', :locals => {:f => }) There is now, in trunk, hash_including matcher, so you *should* (I haven't tried yet) be able to do this: stub_render(hash_including(:locals => {:f => })) That keeps it a bit less brittle, as the previous version will fail if you add anything else to the actual render call this won't fail. Cheers, David > > > > _______________________________________________ > 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