Can't run ruby tests
I have IntelliJ IDEA 13.1.4 installed. I have Ruby 1.9.3 and test-unit gem version 2.5.5 installed. When I try to run tests, I get
/Users/xxx/.rvm/rubies/ruby-1.9.3-p545/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/xxx/Workspaces/project/acceptance_test/selenium-ruby/tests/ControlTest.rb
Testing started at 10:45 AM ...
/Users/xxx/Library/Application Support/IntelliJIdea13/ruby/rb/testing/patch/testunit/test/unit/autorunner.rb:30:in `<class:AutoRunner>': uninitialized constant Test::Unit::AutoRunner::RUNNERS (NameError)
from /Users/xxx/Library/Application Support/IntelliJIdea13/ruby/rb/testing/patch/testunit/test/unit/autorunner.rb:29:in `<module:Unit>'
from /Users/xxx/Library/Application Support/IntelliJIdea13/ruby/rb/testing/patch/testunit/test/unit/autorunner.rb:28:in `<module:Test>'
from /Users/xxx/Library/Application Support/IntelliJIdea13/ruby/rb/testing/patch/testunit/test/unit/autorunner.rb:27:in `<top (required)>'
from /Users/xxx/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/xxx/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/xxx/.rvm/gems/ruby-1.9.3-p545@global/gems/test-unit-2.5.5/lib/test/unit.rb:2:in `<top (required)>'
from /Users/xxx/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/xxx/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/xxx/Workspaces/project/acceptance_test/selenium-ruby/tests/ControlTest.rb:5:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
Searching online, I saw that test-unit might be conflicting with the bundled minitest, so I uninstalled test-unit. With test-unit uninstalled, I get
/Users/xxx/.rvm/rubies/ruby-1.9.3-p545/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/xxx/Workspaces/project/acceptance_test/selenium-ruby/tests/ControlTest.rb
Testing started at 10:19 AM ...
/Users/xxx/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:298:in `to_specs': Could not find 'test-unit' (>= 0) among 52 total gem(s) (Gem::LoadError)
from /Users/xxx/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:309:in `to_spec'
from /Users/xxx/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /Users/xxx/Workspaces/project/acceptance_test/selenium-ruby/tests/ControlTest.rb:4:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
Any ideas on how to get the tests running in IntelliJ? I can run them from the command line fine.
Thanks in advance for your help.
Shawn K.
Edited to add local gem list as attachment.
Attachment(s):
gem.list.zip
请先登录再写评论。
Hi Shawn,
The latter problem (I think) is caused by something like "gem 'test-unit'" in your code. If this is the case then you can not just uninstall test-unit gem
to use minitest, you also need to change your code. Also you will need to use minitest-reporters (see http://www.jetbrains.com/ruby/webhelp/minitest.html)
The original problem looks like a bug in our code: though it is a surprise that you are the first user who reported it (while the plugin is published several months ago)
What version of Ruby plugin are you using?
Are you using Gemfile for your app?
Is it rails or plane ruby application?
Is this the only module in your porject?
What type of module do you have and what facets are added to it?
Regards, Oleg.
Thanks, Oleg,
Indeed, the first 5 lines of the test are:
# encoding: utf-8
require 'rubygems'
require 'selenium-webdriver'
gem "test-unit"
require "test/unit"
I am using:
IntelliJ IDEA 13.1.4 (Build #IU-135.1229) (Same error occurs in the latest IDEA 14 EAP build with latest Ruby plugin)
JRE 1.6.0_65-b14-462-11M4609 x86_64
Ruby plugin version 6.5.2.20140624
I am not using Gemfile.
It is a plain Ruby app (selenium acceptance tests for a Java web project)
There are three modules in the project: the Acceptance Tests (Ruby), the web front end (html, js, Angular, grunt), and the rest services (JAVA, Spting, Jersey, gradle). I can break it out by itself if needed for testing.
Only the rest service module has any facets, Spring and Web Gradle.
I do remember this working previously. It could have been before the current version of the Ruby plugin. Could I downgrade the plugin to test? If so, how would I go about doing that?
Thanks for all your help,
Shawn K.
Hi,
to user older version of plugin you need to uninstall it, download older version from http://plugins.jetbrains.com/plugin/1293?pr=idea and install it manually (install from disk).
Also I'd recommend to try Idea 14 EAP with the latest plugin to see if the problem fixed there.
Regards, Oleg.
Alas, I tried installing the two previous versions of the plugin (6.5.2.20140512 and 6.5.0.20140404), but both are incompatible with 135.1229. I have also tried the latest EAP build of IDEA 14, but it has the same problem as the IDEA 13 latest plugin. Should I open a bug for the error?
Sure, please file a ticket under Ruby project 9https://youtrack.jetbrains.com/issues?q=%23Ruby+)
Oleg.
Opened issue https://youtrack.jetbrains.com/issue/RUBY-15779