[rspec-users] [Rails] specifying that a layout yields?
brandtkurowski at gmail.com
Mon Mar 30 11:25:30 EDT 2009
On Mar 30, 3:39 am, Matt Wynne <m... at mattwynne.net> wrote:
> On 29 Mar 2009, at 02:33, Brandt Kurowski wrote:
> > I recently had a bug in a layout due to the layout not calling "yield"
> > to display the actual content. I wanted to write a spec to describe
> > what was missing, but it wasn't obvious how, so I just fixed the
> > problem first and doubled back to spec it later.
> Did you consider testing this aspect of the view's behaviour from a
> higher-level Cucumber acceptance test? I think that's what I would
> have probably done.
Thanks Matt. It was actually a Cucumber feature that found the bug
(this is a new project that I've yet to actually open a browser on, I
think), so in that sense it's already covered. But I wanted to somehow
specify this very particular piece of behavior so that in the future
if someone breaks it, there's a spec that points right to the problem.
I think that if someone breaks my layout this way (e.g. accidentally
removing the yield in a future edit), most (all?) of my acceptance
tests will fail but it won't be immediately obvious why.
More information about the rspec-users