Skip to content

Conversation

@nathanscottdaniels
Copy link
Contributor

This addresses #54 by adding support for "feature" and "scenario" which are aliases of "describe" and "it" respectively. These come from the capybara gem

@nathanscottdaniels
Copy link
Contributor Author

@st0012 (or any other maintainer) Anything you folks want to see here or can I get a review? Thanks!

@nathanscottdaniels
Copy link
Contributor Author

I would love to stop using our fork and switch to the mainline of this gem if at all possible 🙃

@st0012 st0012 requested a review from Copilot November 18, 2025 16:43
Copilot finished reviewing on behalf of st0012 November 18, 2025 16:45
@st0012
Copy link
Owner

st0012 commented Nov 18, 2025

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?

Copy link

Copilot AI left a 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 for describe) and scenario (alias for it) 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.

@rhyn0bytes
Copy link
Contributor

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?

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 feature and scenario DSL methods as test-structuring keywords within RSpec suites.

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 describe and it. Since Capybara is always used alongside RSpec (not on its own), this small enhancement would allow any RSpec+Capybara project to benefit fully from the addon's test discovery without expanding the scope of the project into supporting Capybara itself.

@st0012 st0012 added the enhancement New feature or request label Nov 26, 2025
Copy link
Owner

@st0012 st0012 left a 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 👍

@st0012 st0012 merged commit e7ff414 into st0012:main Nov 26, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants