[rspec-users] [BDD] View specs and cucumber -- duplication of effort?

Stephen Eley sfeley at gmail.com
Wed Nov 4 11:29:44 EST 2009

On Wed, Nov 4, 2009 at 10:56 AM, Andrew Premdas <apremdas at gmail.com> wrote:
> Putting lots of
> view details in the features (and I should see a wibble field etc. ...)
> pollutes this map with clutter that is not relevant to the "business"
> context. So view specs seem like a really good place to spec all this
> detail.

I think this is a really good point.  However, I'd suggest that this
could still be done in Cucumber.  If you have a step like "Then I
should see my wozbat's details" you could put your detail map in the
step definition:

Then /^I should see my wozbat's details$/ do
  Then "I should see my wozbat's wibble"
  Then "I should see my wozbat's wobble"
  Then "I should see my wozbat's wombat"

And so forth.  Generalize or specialize as needed.

I don't think this is conceptually better than doing it in a view
spec.  View specs probably are philosophically superior in most cases.
 The advantage is that in Cucumber this takes essentially no extra
setup and is fairly concise to read, whereas mocking your model
instances in a view spec is a pain and the specs themselves tend to be
much more verbose.

Have Fun,
   Steve Eley (sfeley at gmail.com)
   ESCAPE POD - The Science Fiction Podcast Magazine

More information about the rspec-users mailing list