[rspec-users] Rails: Specing libraries

Chad Humphries chad at spicycode.com
Sat Dec 22 14:20:37 EST 2007


In most cases you could just create a lib folder under spec with your  
new file in it.  For example if you have:


You would have:


That starts out something like:

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe MyExtension do

And that should about do it.

Chad Humphries

On Dec 22, 2007, at 1:17 PM, Caleb Land wrote:

> I was reading the documentation on using rails with rspec and I  
> didn't see anything about how to spec libraries in the rails /lib  
> directory so that they're integrated into the whole spec::rails  
> system.
> Where should I put specs for my libraries, and what's the best way  
> to require the files that I'm testing in my spec?
> I've never used rspec before, and I'm new to rails, so I'm huge newb.
> -- 
> Caleb Land
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list