OregonDigital/oregondigital — pull request #705 by terrellt (2014-12-05 21:51:55+00:00)
Title: Attempt to use view specs to deal with Capybara.

Don't merge necessarily. This is for discussion.

I'm starting to think I was too vehement about feature specs in the past (points to you @jechols), and I'm starting to explore a few ways to dig my way out. This is one option. Some pros/cons I see:

PROS:

* These tests take 1.5 seconds, the old asset_viewer_spec takes 8.8 seconds.
* These bind us to an interface - those partials need a decorated_object or our tests fail, the decorator NEEDS to respond to #view_partial.

CONS:

* These bind us to an interface. Is this a con? I don't know. It means our tests are enforcing an interface we have to think hard about, but it makes it more painful to make drastic switches unless we're -very- careful about how and where we test things this way.

* This isn't -exactly- the same test. We're testing less - specifically that the link shows up in the search view, and that the viewer actually shows up in the show_default.html.erb. I think I can fix that last bit, but I'd still like to open this to discussion (mostly because to do the last bit I either need to fake out a bunch of stuff or start thinking hard about what our interface is for show_default...which isn't really up to us, it's up to blacklight.)