setting up lib/test/rakefile references for a testing task

R

rpardee

Hey All,

I'm trying to set up a set of project folders & a test task for rake &
am having trouble figuring out how to let all my code find the other
bits of code. My project files & folders are set up like so:

/dbi-ado
rakefile.rb
/lib
/dbd
ado.rb <-- requires lib/dbd/ado/database.rb and lib/dbd/ado/
driver.rb
/ado
database.rb
driver.rb
/test
test_dbd_ado.rb <-- requires lib/dbd/ado

My test task is:

task :test do
# puts("Pretend I am running your tests!")
# Is this the best way to invoke tests? Very much a noob here...
# require 'test/test_dbd_ado'
%x(ruby -I . test/test_dbd_ado.rb)
end

I'm running ruby 1.9.1 on windows. When I do a 'rake test' in my /dbi-
ado folder I get:

C:\Documents and Settings\pardre1\My Documents\ruby\my_gems\dbi-
ado>rake test
(in C:/Documents and Settings/pardre1/My Documents/ruby/my_gems/dbi-
ado)
C:/Documents and Settings/pardre1/My Documents/ruby/my_gems/dbi-ado/
lib/dbd/ado.
rb:4:in `require': no such file to load -- dbd/ado/database
(LoadError)
from C:/Documents and Settings/pardre1/My Documents/ruby/
my_gems/dbi-ado
/lib/dbd/ado.rb:4:in `<top (required)>'
from test/test_dbd_ado.rb:2:in `require'
from test/test_dbd_ado.rb:2:in `<main>'

I don't understand the problem--I thought that passing '.' (current
dir) to ruby's I param would put that dir on the search path for
references & therefor a "require 'dbd/ado/database'" should resolve
properly to dbi-ado/lib/dbd/ado/database.rb. But it seems not.

Can somebody throw me a clue here?

Many thanks!

-Roy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top