Rails: Specing libraries

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,

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

lib/my_extension.rb

You would have:

spec/lib/my_extension_spec.rb

That starts out something like:

require File.expand_path(File.dirname(FILE) + ‘/…/…/spec_helper’)

describe MyExtension do

end

And that should about do it.


Chad H.
http://spicycode.com/