[rspec-users] Where to put macros

Stephen Eley sfeley at gmail.com
Mon Jun 22 13:55:54 EDT 2009

On Mon, Jun 22, 2009 at 12:37 PM, David Chelimsky<dchelimsky at gmail.com> wrote:
> The convention that I see emerging is to keep macros, helpers, and any
> other spec supporting material in spec/support/macros,
> spec/support/matchers, etc.

+1 from me too.  I've been calling my directory spec/helpers, but I've
been working on non-Rails projects lately and it only just now
occurred to me that it would cause a name collision.  >8->

> Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}

On a total non sequitur: has anyone ever come up with a clean, general
syntactic sugar for cleaning up all of these ubiquitous File/Dir class
methods and __FILE__ constants and other ugly filesystem machinery on

If no one knows of such a convenience, I might have to take a day or
so and write something.  Most of the rest of Ruby is so elegant and
pretty that seeing this stuff at the top of every file hurts my eyes a
bit.  It's like getting a small static shock each time you settle into
your comfortable luxury car.

Have Fun,
   Steve Eley (sfeley at gmail.com)
   ESCAPE POD - The Science Fiction Podcast Magazine

More information about the rspec-users mailing list