I can't get shoulda support working
I'm using rubymine EA 1.5 build 1364 and the shoulda support doesn't seem to be working for me. I'm not able to run an individual should block from the test runner. I've checked and I do have the shoulda gem attached (2.0.6).
请先登录再写评论。
Hi Chris,





At first let's check Shoulda support on small example.
1. Open RubyMine #1364
2. File | New Project, choose Project type: Empty Project
3. Creare "test" folder
4. Add should_test.rb file
5. Now let's mark "test" folder as test directory. For this open File | Settings | Project Structure select test folder and press "Test Sources" button
6. Test folder will become green
7. Press Ok and close settings.
8. In should_test.rb type
9. RubyMine will suggest to attach "thoughtbot-shoulda" gem.
10. Press "Alt+Enter", then "Enter" to attach gem
11. Let's require "shoulda" script
12. Now "should" method will be in autocompletion in Test::Unit::TestCase class body
13. Let's create simple shoulda test with content
14. No move caret to assert_equal and invoke context menu


15. Single should block should be executed.
Can you reproduce it?
At first I was not able to reproduce this, but then I realized I was running an earlier version of shoulda (2.0.6). When I upgraded to 2.10.2 your example worked as advertised! I'm going to go back to my real project and see if works there next.
Excellent, it works in my real project too! However, it does not let me run at the context level. It would be oh so nice to run just all the tests in a given context. Is this feature planned?
Chris,
You can vote for http://www.jetbrains.net/jira/browse/RUBY-4846 issue. We don't plan to implement it in nearest future. As far as I know should doesn't allow to easily launch all tests from context.
Hi,
I get the following error when I follow the steps in this thread.
Error running My should simple_test: File 'test/unit/autorunner.rb' not found in $LOAD_PATH of Ruby SDK with interpreter: 'C:/Ruby19/bin/ruby.exe".
Any idea what is going on?
Thanx
jra
Hi John,
Attach "test-unit" gem in RM's Gem manager. In Ruby 1.9 Test::Unit support was extracted to separate gem.
We will add check for test-unit gem in future.
Hi Roman,
I'm new to Ruby so please forgive my pestering u w/this.
My understanding is that ruby 1.9.x replaced test-unit w/minitest and minitest has a test-unit "shim?" for backward compatibility.
If my understanding is correct u are telling me that thoughtbot-shoulda is dependent on ruby 1.8.x test-unit and that I have to install/attach test-unit to run thoughtbot-shoulda tests.
Thanx for your help
John A
John,
Yes you are right. But minitest doesn't support custom test runners so RM cannot attach our GUI runner.
This error means that RubyMine wasn't able to replace dynamically default console runner with GUI one.
To use RM's GUI tests runner you should install gem and attach it to RubyMine. Test-Unit gem isn't necessary for running tests in console.