This feature is supported in the Ultimate edition only.
The following is only valid when Ruby Plugin is installed and enabled!
IntelliJ IDEA helps you write Shoulda tests on attaching the
IntelliJ IDEA provides Shoulda-specific code completion, if one of the following conditions is observed:
- The Bundler is used.
- For Rails 2.*, Shoulda is specified in
- For the Ruby projects,
require 'shoulda'is mandatory.
Refer to Shoulda installation page to learn about using Shoulda in Rails applications.
Having enabled Shoulda support in your project, you can:
- Use Shoulda-aware code completion for the contexts and should blocks:
- Run and debug Shoulda tests using the Test::Unit run/debug configuration, or a user-defined Rake task. In both cases, IntelliJ IDEA will run tests in the test runner UI. So doing, you can launch test cases, should blocks, or all test cases in a directory.
- View Shoulda tests in the File Structure view:
- In the Rails applications, view Shoulda tests in the Test::Unit/Shoulda node of the Rails view:
To enable Shoulda support, follow these general steps
shouldagem to your project.
- Mark as test roots the directories with the Shoulda tests.
Consider creating a Shoulda test in a Ruby project. Create a Test::Unit test template. Note that you can also create a plain Ruby script. In this case, make sure that its name ends with
In an empty Ruby project, add the following statements to the Test::Unit test cases with Shoulda tests:
require "test/unit" require "rubygems" gem "shoulda" require "shoulda"