On Tue, Jan 20, 2009 at 7:44 AM, Bart Zonneveld <zuperinfin...@gmail.com> wrote: > Hey list, > > As a good BDDer I want to test my views in isolation.
Sort of. A *good* BDDer wants to *specify* views in isolation. Testing is for testers :) > And as a good rails > programmer, I separate views into partials when needed. So, when testing my > views, I want to stub out rendering of partials in my views. I'm working on > upgrading an app from rails 2.1.2 to 2.2.2, using the latest rspec and > rspec-rails. > > I used to throw template.stub!(:render) in a before(:each) block and be done > with it That sounds kinda risky because you could be ignoring partials that get rendered that you don't want to be rendered. >, but that doesn't work anymore. I can understand why, but now I have > to do something like template.stub!(:render).with(hash_including(:partial => > anything)). Except for when I'm testing a partial, then I need to replace > the anything with every partial I'm rendering in my partial. > > Is this the correct way, Seems like the only way at the moment. Wouldn't call it correct or incorrect. > or is there perhaps something like > template.stub_partials :only => [], :except => [] ? Nothing like this exists. Seems like a reasonable idea. Feel free to submit a feature request, or better yet, a patch to http://rspec.lighthouseapp.com Cheers, David > > thanks, > bartz > _______________________________________________ > 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