Some Ruby on Rails Plugin Stats

There are now almost 1000 entries in the main resource for Ruby on Rails plugins, Agile Web Development’s Plugins Directory. Of these, 596 have repositories listed that are accessible. I wanted to see how many of these plugins came with some form of tests, so I created a spider (using a web spider library and performed some basic analysis on each repository.

After reading a few magazines, and watching two entire TV shows, the spider came back with a result: 54% of the plugins have tests.

Read More →

Rails Plugin Testing Guide

This article is an introduction to testing Rails plugins. It’s a relatively lengthy post, so if you’re reading this in an RSS reader flag it and come back when you’re not too busy. It follows the “taxonomy” style of my previous plugin article, A taxonomy of Rails plugins, where examples are used from open source software.

Knowledge of both unit and functional testing is assumed. The following topics are covered:

Read More →

Start Using Test Driven Development Today

Start using Test Driven Development today is a post I wrote over on my company’s blog. It covers how TDD has improved my work since I started Helicoid Limited, and how you can start using TDD right now.

  1. Learn how to write basic tests in your chosen language – don’t worry about fully learning the test framework, start by copying examples
  2. When adding a new feature, start by creating tests first. Write code to satisfy these tests
  3. Refactor old code to work well with automated tests
  4. Write test data carefully and patiently, using this as a design technique for exploring the quality of your data modelling
  5. Find a mocking library so you can write encapsulated tests that don’t require external resources
  6. Find a tool for producing coverage reports in your chosen language
  7. Investigate automated testing triggered when deploying/releasing code

    Read More →

10 Essential Ruby Gems

Despite leaving it for a while, I’m going to continue my previous article, “A taxonomy of Rails plugins”, relatively soon. I’ve been inspired by the excellent plugins by errfree and come up with a few ideas of my own during the heavy workload of 2007. In particular, I’d like to clarify testing Rails plugins. But more of that in the near future.

For now, have a look at 10 essential ruby gems. It’s hosted on my company’s new blog, where you’ll eventually find more articles by me with a greater emphasis on web design.

Read More →

A Taxonomy of Rails Plugins

A common stumbling block for Rails developers is learning the basics required to write plugins. This is made more complicated by the fact that Ruby is inherently dynamic and offers many techniques for code reuse. Luckily, if you can write Rails applications you can write plugins by simply drawing on a handful of basic patterns.

The purpose of this article is to demystify writing plugins using examples of common patterns used by popular plugins.

Read More →

Constants are Changing

Boards of Canada wrote a song called Constants are Changing. In Ruby even constants are dynamic, holding a reference to an object rather than the object itself. This consistency makes modifying constants possible, and rather than being something considered distasteful it may form an integral part of the design of a system.

Read More →

Session Encapsulation

Have you ever been working on a project that has session variables controlling important aspects of functionality? When they start falling out of controllers and views into a big pile of soup on the floor it’s probably time to encapsulate them.

Read More →

Tools for Tests (JavaScript Edition)

In my previous article Tools for tests, I discussed tools designed to help write better quality tests. This article expands on the topic by exploring several tools and libraries that help test JavaScript.

Testing JavaScript seems unnatural on the surface, because it’s difficult to see how it can be automated. Tests require a full implementation of the DOM, so it’s hard to imagine how anything but browser–based tests could be useful. Luckily, most operating systems provide some way of accessing applications in a scriptable fashion — AppleScript in Mac OS is the most obvious example. So before you start using alert() to print values and debug code consider this: automating JavaScript testing is definitely possible and you have no excuse for not doing it.

Read More →

Push Back Explored

‘Push Back’ is a simple concept succinctly explained in 37signals’ book, Getting Real. When translating requirements into code, issues often crop up that make implementation impractical. Something about the structure of your project resists a new feature.

Getting Real suggests ways to mitigate push back. I’m going to explain how to spot push back occurring in your code.

Read More →