[rspec-users] Where to put macros

David Chelimsky dchelimsky at gmail.com
Mon Jun 22 12:37:53 EDT 2009


On Mon, Jun 22, 2009 at 11:28 AM, Andrew Premdas<apremdas at gmail.com> wrote:
> Recently I got some wonderful help from the list to create my NamedAddress
> module/macro which tests NamedAddresses for a number of different resources.
> The question I have is where should I put this module? At the moment I've
> got it in spec_helper, but this feels a bit messy
> Many thanks
> Andrew

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. Then you do this in spec/spec_helper.rb:

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

What would folks think if that was included in the generated
spec_helper in spec-rails?

Cheers,
David


More information about the rspec-users mailing list