[rspec-users] noob question (trying to understand view specs vs webrat and cucumber)...
chris at silhouettesolutions.net
Wed Jul 15 23:14:29 EDT 2009
I've been reading the rspec book, and I'm trying to tie everything
together, but I'm a little confused. Keep in mind this is my first
introduction to TDD/BDD. When it came to testing my rails app I jumped
into learning rspec before I ever tried to using any of the built in
test:unit stuff. I'm probably a different breed because of this, most
everyone else has probably been using the stuff built into rails
before ever attempting rspec or cucumber. I didn't see the need to
learn something that everyone is going away from, but if it's a
necessary evil please let me know.
I am to the chapter talking about writing view specs, this chapter is
preceded by a chapter that talks about using webrat matchers to help
you test views, and uses cucumber step definitions. I'm having a
problem understanding when I should use cucumber and when I should use
rspec. If I start my app coding by "spec"ing my views then do I really
need to use cucumber at all? Can someone clarify in "simple" terms the
relationship between rspec and cucumber. I feel I understand them
independently, but I'm confused on how and when I choose to use them
together. I have read through the book pretty thoroughly to this point
and feel I have absorbed everything there is to absorb, but my mind
isn't getting this correlation. When going through the codebreaker
example it had me run my cucumber stuff separate from my rspec stuff.
Looking back it seems the only reason I used both was to develop a
more complete test, but in fact I could use one over the other if I
wanted to? That statement makes sense "to me", but I know it's
I guess while I'm asking questions, I'll ask one more...
If I want to follow the BDD mantra to the tee, then I would spec all
of my views first, and use this as my starting place for adding every
subsequent test after that right? After the views have been "spec"ed
and are re-factored in the "Green" then I would re-factor again by
adding controller methods or model information to get rid of my stub
code. Am I understanding that correctly?
Any information helps me learn.
More information about the rspec-users