anachronic and vines: the joys of lightly populated namespaces
I released my first two real open source projects this week, both Ruby. Kind of nice, never thought it would happen, then it just did.
Vines is a (very small currently) bundle of useful general step definitions for Cucumber, it’s not currently rails specific, and I may make rails-specific steps a different include so it can be used for regular ruby projects.
The only step currently available is very simple, but not provided by cucumber. From its own feature tests:
Feature: Should happen steps
In order to assert errors in my steps
As a developer
I want to talk about a step's side effects or consequences
Scenario: step raises
Then an error should occur when I eval `raise`
Scenario: step raises a certain type
Then an ArgumentError error should occur when I eval `raise ArgumentError`
That’s pretty simple stuff. There was and will be more there, but the code and dependencies had too many rough edges for now.
Anachronic went straight to plugin; in integration testing Paperclip I wanted to know whether deleting site images (my model wrapper for a paperclip image attachment) was cleaning up files correctly. I wanted to do it in Cucumber, and I wanted the steps to be simple.
The idea is very simple really:
When I add a site image
Then the images directory should have changed
When I delete the site image
Then the images directory should be back to how it started off
You could, of course, use git for this, but I didn’t care about file contents, only whether the files still existed. I think it’d make the tests slow. You may also like to use some combination of ls and diff; have fun with those man pages.
Simple solution — snapshot file and directory names recursively, then spot the difference between snapshots.
Wrote some specs, wrote some code, specs passed, put into the rails app as a plugin, wrote steps, green feature. Magic.
So, at last, something other than forks on my github page!

