TestRSpec
RSpec plugin for Sublime Text 3
Details
Installs
- Total 4K
- Win 393
- Mac 3K
- Linux 756
Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | Apr 13 | Apr 12 | Apr 11 | Apr 10 | Apr 9 | Apr 8 | Apr 7 | Apr 6 | Apr 5 | Apr 4 | Apr 3 | Apr 2 | Apr 1 | Mar 31 | Mar 30 | Mar 29 | Mar 28 | Mar 27 | Mar 26 | Mar 25 | Mar 24 | Mar 23 | Mar 22 | Mar 21 | Mar 20 | Mar 19 | Mar 18 | Mar 17 | Mar 16 | Mar 15 | Mar 14 | Mar 13 | Mar 12 | Mar 11 | Mar 10 | Mar 9 | Mar 8 | Mar 7 | Mar 6 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
Mac | 0 | 0 | 2 | 1 | 0 | 2 | 3 | 0 | 0 | 2 | 0 | 3 | 0 | 0 | 0 | 1 | 0 | 2 | 1 | 0 | 2 | 2 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
Readme
- Source
- raw.githubusercontent.com
Sublime TestRSpec
RSpec plugin for Sublime Text 3.
Run, navigate and create specs from Sublime Text.
Installation
Using Package Control:
- Run “Package Control: Install Package” command, find and install
TestRspec
. - Restart Sublime Text.
Manually:
- Clone this repository into your packages folder (in Sublime Text: Preferences -> Browse Packages).
- Restart Sublime Text.
Configuration
TestRSpec tries its best to autodetect how to run RSpec. However, you might need to make adjustments to plugin's configuration if you have an uncommon setup.
Find settings in Preferences -> Package Settings -> TestRSpec.
Key bindings
Find key bindings in Preferences -> Package Settings -> TestRSpec.
Features
Run RSpec
Launch RSpec for:
- Current file (Super+Shift+T)
- Current line (Super+Shift+R)
- Rerun last run spec (Super+Shift+E)
Switch between code and spec
Key binding: Super+.
Jumps from code to spec and vice versa. If there multiple matches, it shows a list with matches.
Create a spec file
Key binding: Super+Shift+C
Creates a spec file when run in a source file.
Uses code snippet defined in settings (create_spec_snippet
).
Copy last ran RSpec command
Key binding: Super+Shift+,
Copies the command of the last run spec. It can be useful e.g. when you want to debug your application within a 'real' terminal.
Tips
Hide inline errors
By default, inline error messages will be displayed whenever a spec fails. Set show_errors_inline
to false in global
settings to prevent this.
Ignore binding.pry when running specs
Sublime does not allow input in the output panel, so if you add binding.pry
, tests get stuck
waiting on input.
To work around this, you can disable the debugger by modifying TestRSpec configuration:
"env": {
"DISABLE_PRY": "true"
},
Alternatively, use pry-remote.
Troubleshooting
Ruby not found or wrong ruby version used
Example error:
/usr/bin/env: ruby: No such file or directory
Override PATH
variable in your shell configuration (~/.bashrc
or ~/.bash_profile
).
Make sure ruby
command runs the right Ruby version in bash
.
Alternatively, update package settings with path to ruby, e.g.:
"rspec_add_to_path": "$HOME/.rbenv/shims",
Spring is not used
Make sure you have both spring
and spring-commands-rspec
in your Gemfile.
If you use binstubs, you also need to run
bundle exec spring binstub rspec
Acknowledgments
Inspired by and uses code from https://github.com/maltize/sublime-text-2-ruby-tests
Contribution
Help is always welcome. Create an issue if you need help.
Sublime Text plugin development links
- Create plugin
- Submit package
- Forum
- Documentation
- Api reference
- Extract package - to extract the default package and understand plugin development basics
- Package settings
- Unofficial documentation
Copyright and license
Copyright © 2016 @astrauka
Licensed under the MIT license.