- Create the two files listed below, a shell script and a ruby file
- Go to RubyMine -> Preferences -> External Tools -> +
- This should launch a new tool dialog. Fill in name, descriptions, etc
- For program, you should link the script you just created.
- For parameters, you should use “$FilePath$”
- Pay attention to working directory so that you can give the correct path to the ruby file in the shell script (line 8).
- Bind this external tool under keymaps (look for the name you just gave it). We replaced the original command-shift-T (the script works for Ruby too)
- Go to RubyMine -> Tools -> Create Command-Line Launcher and create a launcher in the same place as line 10 of the shell script (/usr/local/bin/mine is the default)
After these steps, you should be able to switch between spec files and implementation files. The whole setup relies on your spec folder layout to be the same as your implementation folder layout, so you may need to move some files around. In addition, it assumes that all of your spec files contain the string “_spec” in the name. If you use a different convention, you will need to reassign the `in_spec` regex on line 5 of the ruby file. Lastly, if you try to switch to a spec file that does not exist, we will attempt to create that file for you. This whole thing is a bit of a hack, let me know if you have any improvements. Enjoy your hopefully faster tdd experience.
About the Author
BiographyMore Content by Charles Hansen