RubyMine 5.4.3 Web Help


Running test suits sometimes involves overheads, because every time a test suit is executed, the whole environment (for example, the entire Rails environment for Rails applications) should be reloaded. You can avoid it using the Spork DRb server, which loads the environment only once.

With the Spork DRb server running in the background, you have a choice to execute any testing script using the DRb server, or locally.

In this section:



Prior to launching Spork DRb server, make sure spork gem, and the corresponding testing gems (rspec-rails, cucumber, cucumber-rails, etc.) are used in your application.

Refer to the sections under Ruby Gems Support for details about installing gems and using them in project.

To launch DRb server
  1. On the main menu, choose Tools | Run Spork DRb server....
  2. In the Spork DRb Launch Options dialog box, select the desired testing framework, and click Run.

    If you are going to use spork for the first time in your project, launch the action with the Perform bootstrap check box selected. Thus Spork will patch the testing scripts.

    The DRb server starts in a separate tab of the Run tool window.

To run a test script using the DRb server
  1. Make sure that DRb server is launched using RubyMine and is running in the background.
  2. Run a test script, or one of its examples. Note that the option Use DRb server is automatically selected in the corresponding run configuration. If you want to run this test locally, you have to clear this check box.
To manage the DRb server, use the following buttons:
  • Click stop.gif to stop the DRb server without closing its tab in the Run tool window.
  • Click close.png to close the DRb server tab.
  • Click rerun.png to rerun DRb server in the same tab.
To debug tests, when using Spork, follow these general steps
  1. Make sure the breakpoints are set in the test script you want to debug.
  2. On the main toolbar, click the run/debug configuration selector, and click Edit Configurations.
  3. In the Run/Debug Configurations dialog box, create Spork DRb run/debug configuration. Refer to the section Creating and Editing Run/Debug Configurations for the detailed description of the procedure.
  4. Launch Spork DRb in the debug mode. To do that, with the Spork DRb run/debug configuration selected, click debug, or press Shift+F9Shift+F9Shift+F9Shift+F9Shift+F9Alt+F5Ctrl+F5Shift+Alt+D or Shift+F9Shift+F9Shift F9Shift F9Meta F11Shift F9.
  5. With the Spork DRb server running in the debug mode, run the desired test script.



  • RubyMine creates a temporary run/debug configuration for Spork DRb server. Later you can change this run/debug configuration as required, save it as permanent, and use it to launch the server.
  • If you are using TeamCity, avoid overhead by adding the following statement into Spork.preload :
     require 'teamcity/spec/runner/formatter/teamcity/formatter'

See Also




External Links:

Web Resources: