Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Hydra should allow setting up the Ruby load path #17

Open
brynary opened this issue Aug 22, 2010 · 8 comments
Open

Hydra should allow setting up the Ruby load path #17

brynary opened this issue Aug 22, 2010 · 8 comments

Comments

@brynary
Copy link

brynary commented Aug 22, 2010

When running Test::Unit tests, it is convention to have the test/ directory in the Ruby load path, and when running RSpec tests it's convention to have spec/ in the load path.

I think Hydra's TestTask should support a "libs" option that mirrors Ruby's TestTask "libs" and sets up the load path.

@ngauthier
Copy link
Owner

Sounds good.

I was also thinking about have a "preload" option where you can have it load your test/spec helper. Then in the helper you can modify your load path.

Also, we could just have hydra add the common load paths for test files by default (it already does this with cucumber).

@rodreegez
Copy link

I think it would be worth making Hydra behave like Test::Unit does in this respect (I actually tried that right off the bat).Unless this affect Hydra's interoperability with other testing frameworks?

For me, not having test/ loaded is the only niggle in an otherwise brilliant tool.

@ngauthier
Copy link
Owner

Yeah I was thinking about including test and spec in the load path. The only possible gotcha is that cucumber likes to include lots of stuff for you. Hopefully it won't get in the way.

@adamfortuna
Copy link

+1 for this one. Setting it up as an option in the task or specifically including it would both help. Trying to get a workaround for including test/ in the load path myself -- any quick workaround to include it without branching?

@ngauthier
Copy link
Owner

@adam yeah just set your load path. Maybe you could put this in the rakefile:

$: << File.join(Rails.root, 'test') if Rails.env == 'test'

@rodreegez
Copy link

That is exactly how I've been getting around it. Not exactly pretty, but it does work.

@ngauthier
Copy link
Owner

There is also an undocumented feature:

https://github.com/ngauthier/hydra/blob/master/lib/hydra/worker.rb#L32

You could put:

$: << 'test'

into the file hydra_worker_init.rb, which is loaded when each worker boots up (so this will work remotely too).

@adamfortuna
Copy link

Awesome, thanks! The hydra_worker_init.rb hack worked to get things running smoothly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants