[rspec-users] View spec'ing style
lists at ruby-forum.com
Sun Jan 13 12:14:21 EST 2008
I've been getting my head around view spec'ing lately for a fairly
complex project that makes heavy use of partials in views and I have hit
up against a style puzzle.
I see two strategies for spec'ing views:
Develop detailed specs for each partial and then make sure that the
final view expects that the appropriate partials are included and used.
* it's DRY
* you get a single point of failure if an expectation is not met
* the final specs for a view aren't very explicit and it can be
to figure out all the things a view does without tracing back the
Develop a set of specs for each view that explicitly expect the
important UI elements and treat the rest of the view as a black box
(i.e., you don't care if a particular partial was rendered so long as
the relevant UI elements are there).
* It's explicit and easy to tell what each view does.
* It's not DRY.. you will get multiple points of failure if a partial
* More time consuming and it's easy to miss an expectation in a view.
So... What are people doing? The first? The second? or some
combination of the two?
Posted via http://www.ruby-forum.com/.
More information about the rspec-users