[rspec-users] noob question (trying to understand view specs vs webrat and cucumber)...

Andrew Timberlake andrew at andrewtimberlake.com
Thu Jul 16 02:47:34 EDT 2009

On Thu, Jul 16, 2009 at 7:46 AM,
internetchris<chris at silhouettesolutions.net> wrote:
> Tom,
> I appreciate the reply...
> So would I be correct in saying that I should develop all of my spec
> tests first, and then finish it up by running some cucumber tests?
> Thanks!
> Chris


If you follow strict Behaviour Driven Development, then the behaviour
should be defined before the code. Therefore, the Cucumber scenarios
should come first.

My workflow is like this:
Write Cucumber scenario - It will fail because the path isn't defined
Create route entry
Run Cucumber - It now fails because the controller doesn't exist
Create controller spec - It will fail because there's no controller
Create controller
Spec now fails because required model doesn't exist
Write model spec - It will fail because model doesn't exist
Create model
Flesh out model until model spec passes
Flesh out controller until controller spec passes
Continue until Cucumber scenario passes
Repeat until project is complete :-)

I run autospec so most of the test re-runs are done automatically and
therefore the process continues a lot more smoothly than it sounds.
You'll notice that their are no view specs. I don't use view specs 95%
of the time because Cucumber covers this (previously my view specs
where just an assertion that the view was there).
When theirs something very specific I need to ensure is in the view, I
might add a view spec.

Andrew Timberlake

http://MyMvelope.com - The SIMPLE way to manage your savings

More information about the rspec-users mailing list