[rspec-users] Four Question From an RSpec Baby - Give me something to chew

Lake Denman lists at ruby-forum.com
Thu Sep 4 17:49:57 EDT 2008

So, that was a great response to my questions. Thanks a lot, guys.

Thanks for your help and your suggestions and your time.
The articles you linked to were helpful, no doubt.

I realize now that you're the guy I first heard about story runner from 
with your screencast on it.
I think I saw that about a year ago and I'm just now getting into 
testing.... shame shame shame.
Your insights are warmly welcomed and greatly appreciated. You are right 
when you say that it is never feasible to take weeks off to write code.
Well, it has been one week now and I've taken your advice to start 
writing tests for code that I am changing or fixing.
I promptly downloaded Cucumber and Webrat and set up an 'rspec' branch 
for my app in order to cherry pick commits with the master.
All of a sudden, though, I didn't know anything about Cucumber, Webrat, 
or writing "features".
Not only that, I could only find scarce, miniature examples of Cucumber. 
No examples I found had much to do with a rails app, anyhow.
So, I wrote one Feature and that worked out fine, I guess. I just 
haven't figured out how to re-use a Step, so that's tripping me up.
Controller Specs are a different story... I've written three controller 
specs! Are they good controller specs, Lake? Well, maybe... I'm not 
quite sure.
I guess the "question" turned from "How do I become confident in my 
code? Write Specs!" to "How do I become confident in my Specs?!"

On the positive side, I feel like I am getting stronger with speccing. 
I've been using mocking and stubbing like I never have before. I think 
some things are becoming more natural, easier to grasp. I think the 
reason my brain wouldn't have it was because I was not USING IT, I just 
passively read about it... but I think I've hit that AHA moment with 
mocking and stubbing - or, at least, I'm steadily on my way to the 
climax of the moment.

Thanks for your suggestions and help! I haven't read all of Chelimsky, 
or his friend's blogs, but I will.
I did download the merb-core, though. :)

Matt Wynne,
"Working Effective With Legacy Code" is on the way.
Thanks for taking time out of your day to help out.
Hopefully, I'll be high fiving much more in the future.
Oh, your latest article on your blog struck a note with me... also it 
led me to Michael Feathers blog, Thanks!

Mark Wilden,
First, your suggestion about mocking and stubbing really encouraged me 
to take up the task of learning about and using them. I feel like I 
actually experienced my AHA moment. I think you are right about testing 
units and keeping a unit, a unit. I'll certainly use Mocks and Stubs 
when I end up unit testing and then I'll fondly remember your post.

Avdi Grimm,
Thank you much for your added input. Especially about the book!

Scott Taylor,
Your post encouraged me to relax. The idea of "chipping away" really hit 
home with me especially since I have a... don't say it... a pickaxe!
You are correct about not having enough time.  I'll definitely generate 
the specdoc for the boss.


Hopfully, I didn't leave anything important out... but now on to the 
mashed peas:

Taking Pat's suggestion, I downloaded Cucumber - if you haven't used it, 
try it out. I haven't used story runner, so there!
Anyways, I downloaded Cucumber and started writing a feature and the 
steps. Here is what I came up with:

That feature passes with flying covers. Am I in the right direction with 
it, though?
Unfortunately, my feature fun ran out when I tried to re-use a step name 
in a different step file... Apparantly you can't duplicate steps?

So, I moved on to a controller spec for a controller called 
"admin/issues". Here is what I came up with... Don't cry, it's ugly:

That should be fairly readable, but I don't really know if I'm doing the 
right stuff.
Any pointers would be very helpful.

Those are the two files that I came up with in the last week. Well, I 
came up with a couple more, but those are the more completed ones. I'm 
really grateful that this stuff is falling in line, or at least I hope 
it is.
Thanks for your time guys.


Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list