Forum: RSpec cucumber/rails tutorial #2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
20ee0d23c969c7740d3c936a4675bb23?d=identicon&s=25 Sarah Allen (ultrasaurus)
on 2008-12-29 19:06
I thought you all might be interested in my second tutorial:
http://www.ultrasaurus.com/code/2008/12/rails-2-da...

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 Wynne'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 :)

Cheers,
Sarah
http://www.ultrasaurus.com
3464536ce6396bacc132ad18d2c46489?d=identicon&s=25 Tim Walker (timw)
on 2008-12-30 00:33
(Received via mailing list)
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
20ee0d23c969c7740d3c936a4675bb23?d=identicon&s=25 Sarah Allen (ultrasaurus)
on 2008-12-30 02:30
Tim Walker wrote:
> Question: In your quest for BDD nirvana have you broached the subject
> of setup/teardown and reuse of Setup code?

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

> 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 topic is locked and can not be replied to.