RubyMine 6.3.0 Web Help

RubyMine helps you write tests using the MiniTest testing framework. MiniTest comes bundled with Ruby 1.9.x, but we suggest to use minitest, as a more up-to-date version.

Prerequisites

Before you start, make sure that:

  • minitest is downloaded and installed on your computer. 5.0+

    RubyMine supports minitest versions higher than 3.1.0

  • minitest-reporters, version 0.5.0 or higher, is downloaded and installed on your computer. This gem is required for integration with RubyMine test runner.

    Note

    5.4.3+For minitest >= 5.0.0, minitest-reporters gem is not required.

  • For Windows, win32Console, version '1.3.0' is downloaded and installed.
  • The gems have to be properly attached to your project. For example, if you use the Bundler for managing gems, the required gems should be added to the Gemfile of your project.

    For example, the Gemfile can contain the following code:

    group :test do
        if RUBY_PLATFORM =~ /(win32|w32)/
            gem "win32console", '1.3.0'
        end
        gem "minitest"
        gem 'minitest-reporters', '>= 0.5.0'
        gem 'minitest-reporters', '>= 0.5.0'
        gem 'cucumber-rails'
    end
                        
  • Depending on the version of minitest-reporters gem, one of the following code fragments is added to your tests (if you are working with a Rails application, it is better accomplished with test/test-helper.rb file ):
    • Version 0.8.0 and higher
                        require 
                        'minitest/reporters'
                        MiniTest::Reporters.use!
                     
    • Older versions
                        require
                        'minitest/reporters'
      MiniTest::Unit.runner = MiniTest::SuiteRunner.new
      if ENV["RM_INFO"] || ENV["TEAMCITY_VERSION"]
        MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMineReporter.new
      elsif ENV['TM_PID']
        MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMateReporter.new
      else
        MiniTest::Unit.runner.reporters << MiniTest::Reporters::ProgressReporter.new
      end
                      

      The above code enables specific results reporter, which depends on the environment where tests have been launched: RubyMine, TeamCity CI server, or TextMate text editor/ terminal. This approach is helpful, when you work in a mixed team that uses different IDEs, or text editors.

      Note

      It is important to execute this code at the test initialization, before running the tests.

Also note, that the names of the minitest files match the patterns *_test.rb, or test_*.rb. This limitation is not related to MiniTest, but rather is imposed by RubyMine's code insight.

See Also

Procedures:

Reference:

External Links:

Web Resources: