olimorris / neotest-rspec

🧪 Neotest adapter for RSpec. Works in Docker containers too
MIT License
90 stars 26 forks source link

feat: Support descriptionless it blocks #36

Closed richardmarbach closed 1 year ago

richardmarbach commented 1 year ago

Thanks for the great plugin!

I've run across a case that's not detected yet. It's possible to define "one-liner" tests with a multi-line block:

it do
  expect([]).to be_empty
end

I've added a treesitter query to detect this case.

olimorris commented 1 year ago

Awesome thank you. Does this resolve #27 too?

richardmarbach commented 1 year ago

It doesn't. It seems the issue with this query

((call
    method: (identifier) @func_name (#match? @func_name "^(describe|context|feature)$")
    arguments: (argument_list (_) @namespace.name)
)) @namespace.definition

is that the arguments isn't present. Removing the arguments and using the @func_name as the @namespace.name for the test name and checking if there's a block immediatly following the identifier does the trick. I've opened a PR with the fix: https://github.com/olimorris/neotest-rspec/pull/37