Cucumber/rails tutorial #2

I thought you all might be interested in my second tutorial:
http://www.ultrasaurus.com/code/2008/12/rails-2-day-4-rcov-and-bdd.html

It covers more webrat plus a trickier delete scenario, based on a
previous thread: http://www.ruby-forum.com/topic/171269

I also tried to follow Matt W.'s refactoring advice
http://www.ruby-forum.com/topic/174015#762387 but realized that I still
need to learn a lot before I understand all the Rails magic that goes on
when I call generate scaffold, but I posted that question over on the
wider Rails forum: http://www.ruby-forum.com/topic/174419#new

Interested, as always, if folks read the tutorial and would advise a
different approach or improvements, and I’d be happy to answer questions
if I’m ahead of anyone on the cucumber/rails/ruby learning curve :slight_smile:

Cheers,
Sarah
http://www.ultrasaurus.com

This is outstanding work and very useful, very nice.

Question: In your quest for BDD nirvana have you broached the subject
of setup/teardown and reuse of Setup code?

What is a clean way of establishing a complex baseline state before
operating on it with a suite of cucumber tests and without duplicating
the “Given” in all of the subsequent “When” and “Thens”? Do you add a
“helper.rb” to the steps folder or ? to keep this clean?

Many Thanks!

Sincerely,

Tim

Tim W. wrote:

Question: In your quest for BDD nirvana have you broached the subject
of setup/teardown and reuse of Setup code?

Matt W. has a good blog post about re-using steps in cucumber:
http://blog.mattwynne.net/2008/11/14/dry-up-your-cucumber-steps/

What is a clean way of establishing a complex baseline state before
operating on it with a suite of cucumber tests and without duplicating
the “Given” in all of the subsequent “When” and “Thens”? Do you add a
“helper.rb” to the steps folder or ? to keep this clean?

I also was reading that it is better to just set up your db data and
establish a session, rather than doing all of the actions simulating the
user.

Here’s a related post: http://www.ruby-forum.com/topic/174289#763689

There was another post or maybe it was a blog I was reading that gave
specific example code for how to set up a session without going thru the
login user steps, but I can’t find the reference… perhaps someone
else knows.

I’m glad the tutorial was helpful.

Sarah

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs