Last Updated: June 05, 2016
·
367
· tmartin314

Sublime 3 Custom Rspec Build for Rbenv

Create a new build system, or adjust an existing one.

To create a new one:
Tools -> Build System -> New Build System

You can see the packages under Preferences -> Browse Packages. The custom builds are in the User directory.

Tests will be run for the currently viewed file only.

# ~/Library/Application Support/Sublime Text 3/Packages/User/Rspec-rbenv/RSpec-rbenv.sublime-build
{
  "cmd": ["/usr/local/bin/rbenv", "exec", "bundle", "exec", "rspec", "-I ${file_path}", "$file"],
  "file_regex": "# ([A-Za-z:0-9_./ ]+rb):([0-9]+)",
  "working_dir": "${project_path:${folder:${file_path}}}",
  "selector": "source.ruby.rspec",

  "windows": {
    "cmd": ["rspec.bat", "-I ${file_path}", "$file"]
  }
}