opscode/supermarket — pull request #244 by bcobb (2014-04-01 16:28:52+00:00)
Title: Exercise read-only aspects of cookbook views in a less direct way

:construction:

This is a first draft of what I proposed earlier on Gitter. First draft because:

* Each context would probably end up as its own spec.
* `shared examples` is basically a stringly-typed module. I'd rather use a real Module, but this is good enough to illustrate the approach.
* I removed the search spec, but it might be nice to keep that one around. Curious to hear if anyone's got an opinion on that.

Anyway, the general idea is to test that pages like the index, directory, and show pages are wired up correctly not by making assertions about their markup, but by navigating to/through them before testing something more interactive. If we do want to test things like "when there are five `@recently_updated_cookbooks`, the cookbook index shows them all" then I'd prefer we put those assertions in a view spec.

To be clear: I think these sorts of feature specs at one point had a lot of value. But now that we've fleshed out additional functionality, I don't think testing that certain selectors are present on the screen is a good use of our feature spec harness, and muddles the purpose of such tests.