Using Rubygems
I have a plain Ruby project in the normal setup.rb structure. When I point IDEA at it, everything loads up. However, right-clicking on a test file and trying to run it gets me:
/usr/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /Users/marick/src/publish/graffle/test/text-tests.rb
/Users/marick/src/publish/graffle/test/text-tests.rb:7:in `require': no such file to load -- s4t-utils (LoadError)
from /Users/marick/src/publish/graffle/test/text-tests.rb:7
from -e:1:in `load'
from -e:1
Process finished with exit code 1
s4t-utils is a gem. The problem is that the RUBYOPT=rubygems environment variable isn't passed on. I can easily add -rubygems to the Ruby Arguments in the Run dialog, but that's awfully inconvenient for something that's supposed to make running a focused test easy. I tried adding -rubygems to the Ruby Script and Ruby Test default settings, but they don't have any effect next time I right-click on a test and create a new Run configuration.
I am using Mac Leopard 10.5.1 and plugin 12772.
P.S. In the Ruby on Rails Project settings, General tab, "Environment" is misspelled.
Please sign in to leave a comment.
Hi, Brian.
I`ve just tried adding -rubygems option to default settings of Ruby test, so I have such an args: -rubygems -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)
and everything works fine for me. Maybe you have added -rubygems to the end of args?
I`m using ruby plugin 12838.
p.s. thanks for misspelled comment :)
No, -rubygems is on the front of the argument list. I can do the following:
1. Add -rubygems to make a working test (in this case, in-workflow-order-tests.rb).
2. Copy and paste the working "Ruby arguments" from in-workflow-order-tests.rb to the "Ruby arguments" of the Ruby Test tab of the Default Settings.
3. Go to the project tree, control-click on the file in-workflow-order-tests.rb and pick 'Run in-workflow-order-tests.rb'. I get: `require': no such file to load -- s4t-utils (LoadError)
4. If I Edit Configurations, the configuration for in-workflow-order-tests.rb does not contain -rubygems. The defaults tab still does. (Note: it doesn't have anything to do with making a run configuration for the same file twice. Fails the same way for a different file.)
Hi, Brian!
Please check what kind of run configuration Ruby Plugin have created for your "in-workflow-order-tests.rb". (e.g. look at a icon of the configuration maybe the plugin have created "Ruby Script" Run configuration). Also don't forget that "Default Settings" makes influence only on new run configurations.
When you ask plugin to run ruby file:
If run configuration exists Idea will use it, otherwise will create new one
When you ask plugin to create run configuration Idea analyzes the file:
If the file name ends with "_spec" the plugin will interpret it as RSpec test
If the file contains the class that extends Test::Unit::TestCase plugin will create "Ruby Test" run configuration
If the file is a folder the plugin will suggest "run all specs in folder" or "run all tests in folder" configuration
Otherwise the plugin will create "Ruby Script" run configuration.
I've just added "-rubygems" option to Default settings for "Ruby Test", created File with TestCase class and all was ok.
It has the icon for Ruby Test (and the dialog shows the All Tests in Folder, etc. radio buttons).
New tests have the problem even after I create them after an app shutdown/restart. (The defaults do retain the -rubygems.)
The file contains a class that extends Test::Unit::TestCase.
It happens after I delete all the run configurations.
This is a rubyforge project. I can check in the .iml, .ipr, and .iws files so you can duplicate my setup via anonymous subversion checkout.
Ok, please send me this files by email (roman.chernyatchik at jetbrains dot com)
Fixed version is available for download.