[rspec-users] testing scripts

barsalou barjunk at attglobal.net
Tue Nov 13 14:45:40 EST 2007


So in the past I've written a script that query's a remote DB, takes 
the data, validates it, then does some processing, producing a new file 
with the data in a completely different format.

Since this is a script with it's own set of methods, etc, how do I go 
about testing the pieces parts?

It seems like it should be no different than doing the rails testing I 
have been doing, but I think I'm missing something fundamental about 
ruby.

What I'm doing now is wrapping the methods in a module, then including 
the module at the top of the script.

I'm thinking this will allow me test those methods independently of the 
script itself.

There still the problem of testing the logic of the script, but I'll 
keep banging away, and report back.

Are there other ways one might do testing against a script like this?

Mike B.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the rspec-users mailing list