A Visual Studio Code extension that enhances your RSpec testing workflow by providing quick test execution and method navigation capabilities directly from your test files.
Features
Quick Test Execution
Run individual tests with one click using CodeLens buttons above each it block or describe group
Execute tests directly in VSCode's integrated terminal
Automatically uses bundle exec rspec with the correct line number
Smart Method Navigation
Hover over method names (e.g., #add in describe "#add") to preview the implementation
Click on the preview to jump directly to the method in your source code
Method names are highlighted to indicate navigation capability
Right-click on any method definition to quickly jump to its spec (if one exists)
Rails Controller-Spec Navigation
Quick access to controller spec files directly from your Rails controllers
Shows an "Open Spec" button at the top of controller files
Automatically finds and opens the corresponding spec file in spec/controllers
Requirements
Visual Studio Code v1.85.0 or higher
Ruby and RSpec installed in your project
Bundler for running tests with bundle exec
Installation
Install the extension from the Visual Studio Code Marketplace
Open any RSpec test file (ending in _spec.rb)
You should see "Run spec" buttons appear above your test blocks and method names will be highlighted
How it works
The extension enhances your RSpec test files in two ways:
Test Runner
Adds convenient "Run spec" buttons (CodeLens) above each test block
When clicked, runs the specific test or group using the exact line number
Uses VSCode's integrated terminal with bundle exec rspec path/to/file:line
Method Navigation
Analyzes test descriptions to identify method references (e.g., describe "#add")
Makes these method names hoverable with a preview of the implementation
Provides direct navigation to the method definition in your source code
Controller-Spec Navigation
Detects Rails controller files in the app/controllers directory
Finds matching spec files in spec/controllers
Provides a quick navigation button to jump between implementation and specs
Configuration
You can customize the extension's behavior in your VSCode settings:
RSpec Navigator: Bold Test Methods - Make method names bold to indicate they are hoverable
RSpec Navigator: Enable Run Spec Buttons - Show/hide the CodeLens buttons above test blocks
RSpec Navigator: Show Open Controller Spec Button - Show/hide the button to open controller spec files
RSpec Navigator: Show Go to Spec Context Menu - Show/hide the "Go to Spec" option in the context menu