Can't run individual unit test with build 802

Hi Folks

Prior to build 802 if I positioned the caret in the body of a unit test and pressed Ctrl-Shft-F10 Rubymine would run just that test.
Now when I press Ctrl-Shft-F10 I get an error dialogue saying "Test class not found".

If I press Ctrl-Shft-F10 outside of a method body Rubymine runs all the tests as normal.

As I mentioned this is in build 802. I am running Rubymine on Ubuntu 8.10.

Any suggestions.

Thanks

Regards, Tony

8 comments
Comment actions Permalink

Hi Tony,

Just mark your "test" directory as "Test Sources" in  Settings | Project Structure | Directories

0
Comment actions Permalink

Hi Roman/Kirill

Thanks - I am now able to run a single test again.

Regards, Tony

0
Comment actions Permalink

Maybe I'm too late but afaik all Rails projects have a test directory with just tests - why is this no default? Or would it be if I'd let RubyMine create the project?
From Eclipse I've seen that it automagically detects if a class is a test (as it inherits from some known test super class) and offers a "Run as Test.." option in the context menu...

Finally, the shortcut doesn't work for me (using the MacOS X key map) but I don't find how I might assign it - any hints?

0
Comment actions Permalink

Maybe I'm too late but afaik all Rails projects have a test directory with just tests - why is this no default? Or would it be if I'd let RubyMine create the project?

If your use spec tests such directory will have name "spec" . RubyMine 1.1 should automatically mark "spec" and "test" folder as tests folders.

From Eclipse I've seen that it automagically detects if a class is a test (as it inherits from some known test super class) and offers a "Run as Test.." option in the context menu...

RubyMine also automatically detects if class extends Test::Unit::TestCase, actually this settings is necessary for internal optimization purposes. RM will run single test method if you mouse click(or place cursor) in context of test method/test closure. Run single test class if your click in context of test class and whole file - if outside test class. 

Finally, the shortcut doesn't work for me (using the MacOS X key map) but I don't find how I might assign it - any hints?

Please show me screenshot of context menu.
E.g. this is mine
Picture 2.png

0
Comment actions Permalink
If your use spec tests such directory will have name "spec" ;). RubyMine 1.1 should automatically mark "spec" and "test" folder as tests folders.

You are correct, this perfectly works in a new project...

RubyMine also automatically detects if class extends Test::Unit::TestCase, actually this settings is necessary for internal optimization purposes. RM will run single test method if you mouse click(or place cursor) in context of test method/test closure. Run single test class if your click in context of test class and whole file - if outside test class.

This works as you say, but I was referring to the context menu reflecting this fact. This would make it more obvious what you can do, but the way it works is completely sufficient - simple is beautiful.

Finally, the shortcut doesn't work for me (using the MacOS X key map) but I don't find how I might assign it - any hints?

Please show me screenshot of context menu.

Should have opened my eyes before asking - my context menu looks exactly the same and the shortcut shown works perfectly - now I'll probably never forget it


Finally, attempting to run all tests in a folder fails. These are the error messages:

Fail to load: /Users/petschke/Documents/RubyMine/Test_Project/test/performance/browsing_test.rb:1
      Exception message: Could not find RubyGem ruby-prof (>= 0.6.1)

[...]

/Applications/Dev/RubyMine 1.1.app/rb/testing/runner/tunit_in_folder_runner.rb:64:in `each_object': ObjectSpace is disabled; each_object will only work with Class, pass -X+O to enable (RuntimeError)
from /Applications/Dev/RubyMine 1.1.app/rb/testing/runner/tunit_in_folder_runner.rb:64
from /Applications/Dev/RubyMine 1.1.app/rb/testing/runner/tunit_in_folder_runner.rb:1:in `load'
from -e:1

The first is hopefully simple to resolve (didn't try it yet) but the second seems to be a general problem. Or may it be related to running this with JRuby (1.2)?

0
Comment actions Permalink

Yes, it is related to JRuby

/Applications/Dev/RubyMine 1.1.app/rb/testing/runner/tunit_in_folder_runner.rb:64:in `each_object': ObjectSpace is disabled; each_object will only work with Class, pass -X+O to enable (RuntimeError)


Try to enable ObjectSpace using -X+O I will also check it

0
Comment actions Permalink

Perfectly works and doesn't have the problems I've mentioned in .

It maybe worth to mention how to set this option: Run | Edit Configurations and then the "Edit Defaults" button on the lower left. There I've added the "-X+O" to the Ruby arguments for Test::Unit (maybe required for others also).

0

Please sign in to leave a comment.