RubyMine 2020.2 Help

Run/debug configurations for tests

When you run tests for the first time, RubyMine automatically creates a corresponding RSpec or Test::Unit/Shoulda/MiniTest temporary configuration, which can be saved. If necessary, you can create the required test run/debug configuration manually from the predefined template.

Create a test configuration

Create a test configuration from the Project view

To create a test configuration for a directory containing tests, follow the steps below:

  1. In the Project view Alt+1, right-click a specific test file or a directory containing the required tests, for example, test, spec, or features.

  2. From the context menu, select Create 'All specs in: <directory name>' or Run 'All tests in: <directory name>' depending on the used testing framework.

    Create a test run configuration
  3. In the dialog that opens, specify the run/debug configuration parameters (RSpec or Minitest), apply changes and close the dialog.

Create a test configuration from the editor

To create a test configuration for tests in a specific file, follow the steps below:

  1. Open the test file in the editor and do one of the following:

    • Click the Run button on the gutter next to the required test or test class.

      Run a specific test
    • Place the caret at the required test or test class name and press Alt+Enter.

  2. Select Create 'RSpec: <test name>' or Create 'Minitest: <test name>' and press Enter.

  3. In the dialog that opens, specify the run/debug configuration parameters (RSpec or Minitest), apply changes and close the dialog.

Run/debug configuration: RSpec

You can specify the following settings for newly created or existing RSpec run configuration on the Configuration tab:

Mode

Click one of the radio buttons to define the scope of tests to be performed:

  • All specs in a folder: Select this option, if you want to run all tests in a directory.

  • Spec script: Select this option, if you want to run the specified test script.

Specs folder

Specify the fully qualified path to the directory that contains the desired specs, or click the Browse button and select the specs directory in the dialog that opens. This option is available when the All specs in folder mode is selected.

Example: /Users/jetbrains/RubymineProjects/sample_rails_app/spec

File name mask

Specify the mask of the spec file name. This option is available when the All specs in folder mode is selected.

Example: **/*_spec.rb

Specs script

Specify the name of the script to be executed. This option is available when the Spec script mode is selected.

Example: /Users/jetbrains/RubymineProjects/sample_rails_app/spec/models/user_spec.rb

Example names

Specify the name of the example within the script to be executed. If no example is specified, all examples will be executed. This option is available when the Spec script mode is selected.

Example: name should be present, email should be present

Runner options

Provide additional options to customize RSpec's behavior. You can learn more about the available options from Command line.

'rspec' gem

Use this list to select the desired gem version, which will be used to run the tests. The list shows the versions that are available in the Ruby SDK. By default, the latest available version is taken.

Use custom RSpec runner script

Enable this option if you want to use an alternative spec runner. You can type the fully qualified path to the spec runner in the text field, or click the Browse button, and select the desired runner in the dialog that opens.

Output full backtrace

Select this checkbox to enable the --trace option.

Use pre-load server

Select the server to be used for executing scripts or examples. The following servers are available: DRb, Zeus, and Spring. Select None if you want to execute a test script or example locally, without any server.

Working directory

Specify the working directory used by the running tests.

Environment variables

Specify the list of environment variables as the name-value pairs, separated with semi-colons. Alternatively, click the ellipsis button to create variables and specify their values in the Environment Variables dialog.

Example: RAILS_ENV=test;JRUBY_OPTS=-X+O

Ruby arguments

Specify the command-line arguments to be passed to the Ruby interpreter.

Ruby SDK

Specify the Ruby interpreter used to run tests. You can choose the project default Ruby SDK, or select a different one from the list of configured Ruby SDKs.

Run/debug configuration: Test::Unit/Shoulda/MiniTest

You can specify the following settings for newly created or existing Test::Unit/Shoulda/MiniTest run configuration on the Configuration tab:

Mode

Click one of the radio buttons to define the scope of tests to be performed:

  • All tests in a folder: Select this option to run all tests in a directory.

  • Test script: Select this option to run the specified test script.

  • Test method: Select this option to run the specified test method.

Tests folder

Specify the fully qualified path to the directory that contains the desired tests, or click the Browse button and select the tests directory in the dialog that opens. This option is available when the All tests in folder mode is selected.

Example: /Users/jetbrains/RubymineProjects/sample_rails_app/test

Test file name mask

Specify the mask of the test file name. This option is available when the All tests in folder mode is selected.

Example: **/{*_test,test_*}.rb

Ruby script

Specify the name of the script to be executed. This option is available when the Test script mode is selected.

Example: /Users/jetbrains/RubymineProjects/sample_rails_app/test/models/user_test.rb

Test name filter

Type a filtering expression, or the name of a test method. The test name filter can be a regular expression. This option is available when the Test method mode is selected.

Example: ^test_name_should_be_present$, ^test_email_should_be_present$

Use pre-load server

Select the server to be used for executing scripts or examples. The following servers are available: DRb, Zeus, and Spring. Select None if you want to execute a test script or example locally, without any server.

Working directory

Specify the working directory used by the running tests.

Environment variables

Specify the list of environment variables as the name-value pairs, separated with semi-colons. Alternatively, click the ellipsis button to create variables and specify their values in the Environment Variables dialog.

Example: RAILS_ENV=test;JRUBY_OPTS=-X+O

Ruby arguments

Specify the command-line arguments to be passed to the Ruby interpreter.

Example: -Itest

Ruby SDK

Specify the Ruby interpreter used to run tests. You can choose the project default Ruby SDK, or select a different one from the list of configured Ruby SDKs.

Last modified: 27 August 2020