[rspec-users] Application-wide spec_helper method

Nick Hoffman nick at deadorange.com
Fri Aug 29 22:40:25 EDT 2008


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:

$ script/spec spec/models/property_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/ 
active_support/dependencies.rb:278:in `load_missing_constant':  
uninitialized constant ModelSpeccer (NameError)

Any suggestions for how to correct this? Thanks!
Nick


More information about the rspec-users mailing list