This post originated from an RSS feed registered with Agile Buzz
by Jared Richardson.
Original Post: Tips for Writing a Ruby On Rails Database Adapter
Feed Title: Jared's Weblog
Feed URL: http://www.jaredrichardson.net/blog/index.rss
Feed Description: Jared's weblog.
The web site was created after the launch of the book "Ship It!" and discusses issues from Continuous Integration to web hosting providers.
I've been working on a Ruby database driver for Ingres. Most of the work has been in C, but I finally have my Ruby code (via C) fetching data from the database.
Now I'm starting on the Ruby on Rails portion. It involves adding a lot of additional calls that I didn't have in place. It's actually a pretty big test suite to get your head around. I'm sure it'll be simple once I understand it all. :)
I met Mike Laster at a local Ruby meetup. He's writing a Rails adapter too (small world!) and he's been giving me a few hints. I thought I'd pass on a few of them.
Build against the stable version first
so you don't have a moving target. Once you pass 100% of the tests,
then work on integrating it into the trunk code.
When you run the unit tests, it is easier during development to focus on one unit test at a time instead of getting flooded with thousands of errors at a time.
The trick I use is:
- Change to the rails/activerecord/test directory
- run "ruby -I "connections/native_frontbase" adapter_test.rb -v
adapter_test.rb seems to be a good one to start with. If it doesn't pass 100% there is no hope of any other test functioning.
The first few that I remember needing to pass were:
adapter_test
base_test
pk_test
finder_test
The other tests tend to fall into place once these are working.
Hopefully this will help out a few other people as well.