I have a batch program (yes, coders like me still exist) that, while
the same models are our web app, it isn't webby at all. Basically, I
through the database and send emails.
I changed the email delivery system and I want to write some testing
The test code I had written previously was terrible and no longer
due to neglect and schedules.
So, what;s a good way to test a batch program? And end-to-end test
God for the test/mocks facility) will require that I use 6 or 7 tables
through a lot of code that's already been tested. Testing will
consist of querying
my mock emailer to see if it "sent" the right number of emails, etc.
And then I
can query tables to see if rows are properly modified. Blah.
On the other hand, the emailer has a fair number (50? 60?) of
methods that "can't possibly" be wrong, so unit testing isn't floating
The methods typically wrap a ActiveModel.find or iterate over an
course, if I was sure that these little perfect methods were being
properly I wouldn't need to test!
So is there an alternative technique other than to just run a fake
(did I mention the setup is a PITA?) and check the tables and mock