RubyMine 7.0.1 Web Help

Though RubyMine provides RSpec test template by default, the complete RSpec support only becomes available, when rspec gem is attached to your Ruby project. RubyMine's RSpec support, in particular, includes:

  • The possibility to run and debug individual examples:

    ruby_runTestMethod.png
    Click thumbnail to view larger image.


  • Use RSpec-specific code completion:

    ruby_rspecCodeCompletion.png
    Click thumbnail to view larger image.


To enable RSpec support in a Ruby project, perform these general steps:
  1. Create a directory, for example, rspec, that will be used for testing purposes.

    ruby_createTestFolder.png

  2. Mark the new directory as a test source.

    ruby_markContentRoot.png

  3. Make sure that rspec gem is added to your project.
  4. In the directory you've created for testing, generate test templates.
  5. Run or debug your spec.

    If you are using the bundler, make sure that in the RSpec run/debug configuration the check box Run the script in context of the bundle is selected.
    Note that you can execute all tests in a folder, specific test script, or individual examples in a script.

    • To execute all tests in a folder, in the Project tool window right-click the folder that contains specs, and choose Run: All specs in <folder name> on the context menu.
    • To execute a test script, right-click the spec in the Project tool window, or open this spec in the editor and right-click somewhere outside individual examples. Then choose Run <spec name>. on the context menu.
    • To execute an individual example, open the desired spec in the editor, right-click the example to be executed, and choose Run <Spec name><example name>

See Also

Procedures:

Reference:

Web Resources: