jstorimer / spin

Spin speeds up your Rails testing workflow by preloading your Rails environment.

Home Page:http://jstorimer.github.com/spin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

missing test_helper

gs opened this issue · comments

I have installed spin and kicker

I am using rails 2.3.14 and copied environment.rb to application.rb

Spin and kicker started successful, but error occures when trying to run a test:

Executing: ruby -r test/functional/user_controller_test.rb -e ''
./test/functional/user_controller_test.rb:1:in `require': no such file to load -- test_helper (LoadError)
from ./test/functional/user_controller_test.rb:1

Not sure if this is Spin or Kicker issue.

Please check,
Grzegorz

This is a load path issue. I'll have to add a -I flag to the spin binary just like Ruby supports.

In the meantime you can add the test/ directory to your load path with

export RUBYLIB=test

Also, copying environment.rb to application.rb will likely not give you the results you want. This tool wasn't build with Rails 2.x support in mind, though I'd be happy to accept a patch that added it.

Read here for more about why this won't work as expected: http://jstorimer.github.com/spin/#section-9

Hey,

where exactly shall I add this

export RUBYLIB=test

I've tried to add it into my .bash_profile in above way or with full path to test folder but then I get totally different error
`load_missing_constant': uninitialized constant Rails::Plugin::Synthesis::AssetPackageHelper (NameError).

This tools seems to me awesome as it really speed up! But have to figure out why it does not work for me.

Br,
Grzegorz

You don't need the RUBYLIB hack anymore. As of version 0.1.3 you can use the -I argument when booting up the server.

spin serve -Itest

Hey,

Thanks for implementing this but after update of spin I get

Executing: spin push -r test/functional/user_controller_test.rb -e ''
/Users/grzegorz/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/optparse.rb:1450:in complete': invalid option: -e (OptionParser::InvalidOption) from /Users/grzegorz/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/optparse.rb:1448:incatch'
from /Users/grzegorz/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/optparse.rb:1448:in complete' from /Users/grzegorz/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/optparse.rb:1287:inparse_in_order'
from /Users/grzegorz/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/optparse.rb:1254:in catch' from /Users/grzegorz/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/optparse.rb:1254:inparse_in_order'
from /Users/grzegorz/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/optparse.rb:1248:in order!' from /Users/grzegorz/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/optparse.rb:1339:inpermute!'
from /Users/grzegorz/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/optparse.rb:1360:in parse!' from /Users/grzegorz/.rvm/gems/ree-1.8.7-2011.03@qype/gems/spin-0.1.3/bin/spin:141 from /Users/grzegorz/.rvm/gems/ree-1.8.7-2011.03@qype/bin/spin:19:inload'
from /Users/grzegorz/.rvm/gems/ree-1.8.7-2011.03@qype/bin/spin:19

09:53:20.38 | Failed (256)

Could you please check it?

Thanks for the report, I fixed the problem in version 0.1.4. Can you try that?

Hey!

Thx for fixing it and now I get no error :). Which is good.
As this was not designed to work with Rails 2 maybe thats the problem as when I run now
spin serve -Itest

and

spin push test/functional/user_controller_test.rb

then the message is:
Loading ["test/functional/user_controller_test.rb"]

No examples found.

Finished in 0.00005 seconds
0 examples, 0 failures

and same when I run the kicker

kicker -r rails -b "spin push"
16:33:42.59 | Watching for changes on: /Users/grzegorz/Work/qype/main/qype
16:33:42.59 |
16:33:46.27 | Executing: spin push -r test/functional/user_controller_test.rb -e ''

Spinning up test/functional/user_controller_test.rb

16:33:46.39 | Success

and

No examples found.

Finished in 0.00006 seconds
0 examples, 0 failures

any ideas?

What test framework are you using here? RSpec?

No, these are normal unit tests.

The tool wasn't built with Rails 2 in mind, and I don't have a Rails 2 app handy that I can test with. The discussion going on in #5 might lead to a solution for Rails 2.

In the meantime can you share your Rails 2 app? Or provide a simple set of instructions to reproduce the issue on Rails 2?

Hey!

Thanks,
I've cloned the repo from @mathiewul and it worked.

I like the idea of loading once the rails env and then speed up the tests. I am coauthor of
https://github.com/maltize/sublime-text-2-ruby-tests and I would like to integrate spin & run test faster (the single file and single test from file)

As in project that I work with running tests takes ages.

Cool. I'm not a sublime user or a pythonista, but if I can be of any help let me know :)

Hey!

So it would be great if I could run spin like:

spin push test/unit/user_test.rb -n /user_login_test/

Then I would run only single test from file.
Also is it possible to integrate spin with growl-notifier? So then I could see the results after finish.

What do you think about those stuff?

I'm pretty hesitant about integrating growl since it's OSX specific. I'd prefer to implement some kind of hook system so you can do notifications any way you want.