Metaprogramming can be difficult and sometimes confusing,
and using it inside a library as large as Active Record even more so. Fortunately, there
are a wealth of testing and debugging aids at your disposal, so you can be sure your code is
correct.
CHAPTER 5 ?– BONUS FEATURES 123
Active Record Testing and
Debugging
As you??™ve seen throughout this book, a number of features and intentional design decisions
went into Active Record to make it quite unique in the world of database communication
libraries. Testing and debugging are two more areas in which Active Record was designed to be
both easy and useful to implement.
To be honest, Active Record doesn??™t really have testing built in so much as it was designed
to take full advantage of Ruby??™s preexisting Unit Testing library. An in-depth look at unit testing
is outside the scope of this book, but we do need to cover a large portion of the concepts
and options so that we can write some Active Record tests.
We??™ll start this chapter by covering the details of Ruby unit testing as they relate to
Active Record tests.
Pages:
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294