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: Specifying which button webrat should press - RSpec - Ruby-Forum
I also tried to follow Matt W.'s refactoring advice
Newbie cucumber tutorial - RSpec - Ruby-Forum 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: ApplicationController: understanding generate scaffold - Rails - Ruby-Forum
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
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: Cucumber speed tips - RSpec - Ruby-Forum
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