Functional Testing using a Matrix to cover all edge cases [video]

Posted by Dr Nic on May 22, 2007

I’ve been a fan of Ryan Davis‘ (zenspider) and Eric Hodel‘ ZenTest library (including its autotest CI tool for rails and gems), and their Hoe gem, the Rubyforge gem, etc ever since I figured out what they did. (Side note: how to setup rubyforge gem)

Over the last month, Ryan mentioned “functional testing by a matrix” in four great blog articles.

Ryan shows this off at RejectConf; its 16 minutes but definitely worth your time to investigate, as I think this will be awesome for ensuring basic edge cases are thoroughly tested. Can a guest create something? Can a member delete something?

It is hard to see the code on the screen, but look at the blog posts linked above to get the gist of what is being shown.

People were really interested this as you can tell by the huge number of questions, despite this being the last of many many presentations.

This stuff looks primed for a sweet generator to create the test file.

Railsconf => 4 tracks; JavaOne => simultaneous 14 tracks!!

Posted by Dr Nic on April 27, 2007

MyConfPlan now includes all the sessions for next month’s JavaOne conference. It is huge! 400+ sessions, with up to 14 simultaneous sessions.

I’m going to JavaOne 2007

Remember to go see Charles Nutter’s JRuby session.

“Reads -> slaves, writes -> master” plugin

Posted by Dr Nic on April 15, 2007

Another solution to multiple connections in Rails has been put together by the Revolution Health team.

Look at this sweet database.yml syntax:

dbs:

  database: master_db
  host: master-host

  read_only:
    database: slave_db
    host: slave-host

ActsAsReadonlyable adds support of multiple read-only slave databases to ActiveRecord models. When a model is marked with acts_as_readonlyable, some of AR finders are overridden to run against a slave DB. The supported finders are find, find_by_sql, count_by_sql, find_[all_]by_*, and reload.

README all about it.

Dr Nic’s Tumblelog

Posted by Dr Nic on March 05, 2007

Everyday I have 100s of blog articles to read [Ed: mostly I read the title and press the 'N' button], so I’m fearful of dumping random ideas and links into this blog. This blog is for dumping random code chunks and releasing fancy-pancy new projects. Its mostly devoid of opinion.

Solution: a tumblelog Tumblelog RSS full of random scraps and chunky opinion. By random I mean, things related to Ruby, Rails, Javascript, etc that fit nicely amongst the things we all care about already. Plus pictures of me and my family, because I’m just narcissistic enough to think you might care :)

Tumblr made it too easy to not start a Tumblelog.

RailsRally 2007 and GemsOnRails

Posted by Dr Nic on February 09, 2007

In the past there has been RailsDay, but now the locals of Brazil are running a week-long competition - RailsRally.

The organiser, Ronie Uliana, There are some interesting rules for others who might want to run a RailsRally for people outside of Brazil:

  • Teams of any size - you just have to figure out how you’re going to split the prizes!
  • Competition runs for 7 days
  • To prevent you pre-writing your application, there will be a theme for all applications, announced at the start of the competition.
  • No external gems allowed. I thought this was a harsh limitation, but Ronie said they will support the native-compiled gems like Hpricot and RMagik, and other gems could be frozen into your application code base with Gems on Rails [summary below].

Gems on Rails

This Rails plugin allows you to freeze or link a gem into your rails source (inspired by Rick Olsen’s gems plugin)

Install:

To install the plugin:

> gem install gemsonrails
> cd rails-app-folder
> gemsonrails

Usage:

rake gems:freeze   GEM=gem_to_freeze
rake gems:link     GEM=gem_to_link
rake gems:unfreeze GEM=gem_to_unfreeze_or_unlink

The gems are loaded into vendor/gems and are loaded automatically. Any rake task files from the gems are also automatically loaded via your root Rakefile (that is, if you type rake -T from your application path the rake files in your gems are included; very nifty)
.
This plugin is experimental, and will invoke an init.rb file in the root of the gem if it has one, else it just adds the gem into the LOAD_PATH, and you’ll need to require it as per normal.

If the target gem doesn’t have an init.rb, you can create one in the vendor/gems/<gem-name>/ folder to do any preloading you’d like; instead of doing it in environment.rb.

This plugin was written by moi, and is used in a production environment, but still proceed with caution and ping me with any quirks or features.