Test::Unit Special Notes
Test::Unit comes bundled with Ruby 1.8.x, and in general requires no additional tuning. If you are working in IntelliJ IDEA with Rails 3.x, or with Rails 2.3.x and without the
test-unit gem, you can use this framework "out-of-the-box".
However, there are certain situations when IntelliJ IDEA will be unable to plug the test runner UI to the test engine:
Ruby 1.9.x with a limited version of Test::Unit
Use the complete version, which is distributed by means of the
test-unit gem. If this gem is missing, the test results will be shown in the console, and the test runner UI will only show the error message "No tests were found".
If you want the test runner UI show the tree view of test results, include
test-unit gem in your Gemfile.
Rails 2.3.x and test-unit gem
The problem affects all Test::Unit-based testing frameworks. To fix this problem, you have to manually enable the Test::Unit custom reporter, as described below.
To enable Test::Unit custom reporter for your test
Open for editing the
config/environment.rbfile, and disable
test-unitgem autoload. To do that, modify the
Rails::Initializer.run do |config| ... config.gem 'test-unit', :lib => false ... end
- Open for editing the
test_helper.rbfile, and enable the IntelliJ IDEA formatter manually. To do that, modify the source code as shown below.
It is important to enable it after
environment.rbhas been required, but before the
# test/test_helper.rb ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") # RubyMine if ENV["RUBYMINE_TESTUNIT_REPORTER"] $:.unshift(ENV["RUBYMINE_TESTUNIT_REPORTER"]) $:.uniq! end require 'test_help' # !!! test_helper script loads 'test/unit' ...