On Fri, Aug 29, 2008 at 11:05 PM, Scott Taylor <[EMAIL PROTECTED]> wrote: > > On Aug 29, 2008, at 10:40 PM, Nick Hoffman wrote: > >> On 2008-08-28, at 13:27, Zach Dennis wrote: >>> >>> You can put it in a module and include it for model specs in >>> spec_helper.rb >>> >>> Spec::Runner.configure do |config| >>> # ... >>> config.include DescribeModelAttributeSpecHelper, :type => :model >>> end >>> >>> Zach >> >> Hi Zach. I put the methods into the module "ModelSpeccer" in >> lib/ModelSpeccer.rb and then added this to spec_helper.rb : >> config.include ModelSpeccer, :type => :model >> >> Unfortunately though, when I run my specs, Ruby isn't finding the module: > > This isn't ruby - if you want ruby to include it, you'll need a require > statement (or a load, or autoload).
I think Scott means to say "this isn't rspec, you need to tell ruby to load the file using require". I would keep your spec helpers separate from application code (like app/ or lib/ directories). I typically put these files in spec/spec_helpers/ and then in your spec_helper.rb I require all ruby files like so: Dir[File.dirname(__FILE__) + "/spec_helpers/**/*.rb"].each do |f| require f end Just a thought, -- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users