Not cleaning out test database before running tests.

IMHO, when installing Rubymine (3.2.2) from default, it sets up the default test environment incorrectly. It is running "ruby -ltest" as a test environment instead of "rake". Example:

RubyMine output when running a specfic unit test:

/home/wanchic/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) -Itest /home/wanchic/Project/test/unit/patient_test.rb

When RubyMine does this, it does not load the test environment properly, hence resulting in the above implied error, "Not cleaning out test database before running tests." If I was to run this from command line, like so:

 rake test:units TEST=test/unit/patient_test.rb

The proper test environment is loaded, the test databse is properly cleaned, and tests run successfully.

RubyMine's script will only work if the follwoing is run at commandline, each and every time before running a RubyMine test:
 rake db:test:prepare

I've tried this with PostgreSQL and sqlite3, with same results.

My suggestion, is to change the new defaults for RubyMine so that when individual unit, controller, etc, tests are created, the following is generated instead:

/home/wanchic/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/wanchic/.rvm/gems/ruby-1.9.2-p180@rails31/bin/rake test TEST=/home/wanchic/Project/test/unit/patient_test.rb

In the meantime, how can I manly change this on my own?

To note, I am using:
ubuntu 10.04 LTS desktop

RubyMine 3.2.2 -107.446

ruby - 1.9.2-180

rails 3.1.0.rc4
pg 0.11.0
sqlite3 1.3.4
factory_girl 2.0.2
test-unit 2.3.0
shoulda 2.11.3

- Eric

Comment actions Permalink

I'm not the only one needing this solution. If you examine Issue: 5315130 ( you'll see lylo is on a mac and he too is experiencing issues with ruby -itest. If -Itest works well for others, that's great. But, we need the option to utilize 'rake' tests instead of 'ruby -itest' easily with the integration of CTRL+SHIFT+F10.

Comment actions Permalink

Hi Eric,

Thank you for a suggestion, I filed an issue - I think that more general way is to allow rake task automatic execution before run configuration (


Please sign in to leave a comment.