-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add capybara keyword support #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@st0012 (or any other maintainer) Anything you folks want to see here or can I get a review? Thanks! |
|
I would love to stop using our fork and switch to the mainline of this gem if at all possible 🙃 |
|
I'm a bit hesitant about adding support for capybara as 1) I'm not and wasn't a user of it, so I don't know how to support it and 2) technically this is an addon for RSpec, not capybara Is this the only changes most capybara users will need for this addon to work in their projects? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for Capybara's feature and scenario keywords, which are aliases for RSpec's describe and it respectively, addressing issue #54. The implementation extends three core modules to recognize these keywords when parsing RSpec test files.
- Adds
feature(alias fordescribe) andscenario(alias forit) keywords to test discovery, code lens, and document symbol handlers - Includes test coverage for the new keywords in test discovery functionality
- Enables LSP features like test discovery and execution to work with Capybara-style test syntax
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| spec/test_discovery_spec.rb | Adds test case verifying that feature and scenario blocks are correctly discovered alongside regular RSpec syntax |
| lib/ruby_lsp/ruby_lsp_rspec/test_discovery.rb | Extends test discovery to recognize feature as a group keyword and scenario as an example keyword |
| lib/ruby_lsp/ruby_lsp_rspec/document_symbol.rb | Adds feature and scenario to document symbol parsing (contains bug: scenario incorrectly added to both example and group lists) |
| lib/ruby_lsp/ruby_lsp_rspec/code_lens.rb | Extends code lens generation to support feature and scenario keywords |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hi @st0012, I totally understand the hesitation. To clarify, this change wouldn’t add Capybara support per se. I work with @nathanscottdaniels, and what we’re hoping for is simply recognition of Capybara’s As far as we know, those are the only Capybara-specific terms that define test structure when used with RSpec. Adding them would allow the ruby-lsp-rspec addon to detect these blocks as test “nodes” in the same way it currently does for |
st0012
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok let's give it a try then 👍
This addresses #54 by adding support for "feature" and "scenario" which are aliases of "describe" and "it" respectively. These come from the capybara gem