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).

If you want rails const_missing stuff to load it automatically, I'm guessing you'll need to name the file lib/model_speccer.rb, and the module to be named ModelSpeccer

Scott

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to