[rspec-users] Testing layouts with RSpec on Rails

Matt Patterson matt-lists at reprocessed.org
Tue Oct 9 16:12:09 EDT 2007

On 9 Oct 2007, at 19:55, Jean-François Trân wrote:

> 2007/10/9, Lance Carlson <lancecarlson at gmail.com>:
>> or if you want to test that it is being called.. you could do
>> template.should_receive(:yield).and_return('')
> I'm missing a point... how can you expect to receive a :yield message
> since yield is a Ruby keyword ?

That was kind of my original point...

It occured to me that it would be nice to have a spec that would barf  
if I ever nuked the layout's yield (or, indeed, one of its  
content_for yields), mainly because they're the integration point  
between layouts and views, and we're primarily testing them in  
isolation (a good thing...)

I was mainly wondering if anyone had some great practices in testing  
those integration points, and layout stuff in general, that I could  
learn from...


   Matt Patterson | Design & Code
   <matt at reprocessed org> | http://www.reprocessed.org/

More information about the rspec-users mailing list