gma / tconsole

Testing console for Rails. Helps out with test performance and also makes it easier to run specific tests
177 stars 18 forks source link

don't working on ruby 2.1.0 #75

Closed aelaa closed 10 years ago

aelaa commented 10 years ago

"An error occured: undefined method `suite_counts' for :run:Symbol Couldn't load the test environment. Exiting." Just on trying to run tconsole. Ubuntu 12.04, ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

gma commented 10 years ago

Thanks - I can reproduce it. Will take a look.

jdrnetworking commented 10 years ago

In Ruby 2.1, the return value for a method definition is a symbol of the method name. MiniTestHandler.patch_minitest redefines the run method to do nothing, but has the side effect of returning the symbol :run from the block, which is passed up the call chain several levels where Config#cache_test_ids tries to call #suite_counts on it.

The commit that added the second call to patch_minitest (25468aa5) was created a week after the first (03b5c47b), and I suspect it had something to do with gma/tconsole#49, but I don't know for sure. I know this works in Ruby 2.1 with Minitest 4.7.5, but have not tested in other versions of ruby or Minitest. This issue could also be resolved by explicitly returning nil from the minitest patch, but I'd feel better knowing why Alan put in a second call to #patch_minitest and what the intended return value of MiniTestHandler.preload_elements is.

gma commented 10 years ago

@jdrnetworking Thanks for this. I'll take a look at it and merge (hopefully) tomorrow.

jdrnetworking commented 10 years ago

No problem. As I said, #75 can also be resolved by returning nil from the patch, and that may be the right thing to do, but it still leaves two calls to patch_minitest.

gma commented 10 years ago

I've merged #76 which should fix this bug.

aelaa commented 10 years ago

Plz update it on Rubygems. Thanks =)