RubyMine 7.0.2 Web Help

Creating Test Templates

The most basic way to create test templates is to use the regular procedure of creating files in project. This means is available for both plain Ruby projects, and for the Rails applications, and allows creating stub tests for Test::Unit, RSpec and Test-Spec.

For RSpec and Test-Spec RubyMine provides a number of generators. These generators are context-sensitive, and become available depending on the selected location, and on the gems activated for your project. For example, if rspec-rails is activated, the usual generators are hidden, and the list of generators includes only those specific for RSpec.

To create a test template, follow these general steps

  1. Select the target location in the Project tool window.
  2. Press Alt+Insert.
  3. In the New pop-up menu, select the desired test template:

    ruby_generateTest.png

  4. For an RSpec or Test-Spec test templates, specify the names for the test file, behavior, and "should". For a TestUnit test template, specify the name for the file and test case.

    ruby_generateTest_rspec.png

To generate a RSpec or test-spec test template, follow these general steps

  1. Press Alt+Insert.
  2. In the Generate pop-up menu, select the desired test template.
  3. Specify the test generator arguments, if any, and options, and click OK. The respective generator script is executed, and displays its output in the console tab of the Run tool window.

See Also

Web Resources:

Last modified: 24 January 2015
comments powered by Disqus