RubyMine 7.0.0 Web Help

Test::Unit comes bundled with Ruby 1.8.x, and in general requires no additional tuning. If you are working in RubyMine 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 RubyMine 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
  1. Open for editing the config/environment.rb file, and disable test-unit gem autoload. To do that, modify the environment.rb as follows:
    Rails::Initializer.run do |config|
      ...
      config.gem 'test-unit', :lib => false
      ...
    end
    
  2. Open for editing the test_helper.rb file, and enable the RubyMine formatter manually. To do that, modify the source code as shown below.

    It is important to enable it after environment.rb has been required, but before the require 'test/unit' call.

    # 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'
    ...
    

See Also

Procedures:

External Links:

Web Resources: