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).

8 comments
Comment actions Permalink

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
Screen shot 2009-09-12 at 15.10.22.png
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
Screen shot 2009-09-12 at 15.24.39.png
6. Test folder will become green
Screen shot 2009-09-12 at 15.25.05.png
7. Press Ok and close settings.
Screen shot 2009-09-12 at 15.25.57.png
8. In should_test.rb type
Screen shot 2009-09-12 at 15.12.13.png


require 'rubygems'
gem 'thoughtbot-shoulda'


9. RubyMine will suggest to attach "thoughtbot-shoulda" gem.
Screen shot 2009-09-12 at 15.14.35.png
10. Press "Alt+Enter",  then "Enter" to attach gem
Screen shot 2009-09-12 at 15.15.12.png
11. Let's require "shoulda" script
Screen shot 2009-09-12 at 15.16.38.png
12. Now "should" method will be in autocompletion in Test::Unit::TestCase class body
Screen shot 2009-09-12 at 15.17.44.png
13. Let's create simple shoulda test with content


require 'rubygems'
gem 'thoughtbot-shoulda'

require 'shoulda'

class MyTest < Test::Unit::TestCase
  should "simple test" do
    assert_equal(1, 1)
  end
end

14. No move caret to assert_equal and invoke context menu
Screen shot 2009-09-12 at 15.22.03.png
15. Single should block should be executed.
Screen shot 2009-09-12 at 15.27.19.png

Can you reproduce it?

0
Comment actions Permalink

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.

0
Comment actions Permalink

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?

0
Comment actions Permalink

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.

0
Comment actions Permalink

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

0
Comment actions Permalink

Hi John,

Attach "test-unit" gem in RM's Gem manager. In Ruby 1.9 Test::Unit support was extracted to separate gem.

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".


We will add check for test-unit gem in future.

0
Comment actions Permalink

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

0
Comment actions Permalink

John,

My understanding is that ruby 1.9.x replaced test-unit w/minitest and minitest has a test-unit "shim?" for backward compatibility.

Yes you are right. But minitest doesn't support custom test runners so RM cannot attach our GUI runner.

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".

This error means that RubyMine wasn't able to replace dynamically default console runner with GUI one.

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

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.

0

Please sign in to leave a comment.