Skip to content

Conversation

@vitallium
Copy link
Collaborator

@vitallium vitallium commented Jan 9, 2026

Given this Ruby file:

require "test_helper"

class CategoryTest < ActiveSupport::TestCase
  context "validations" do
    should validate_presence_of(:name)
    should validate_length_of(:name).is_at_most(255)
    should validate_uniqueness_of(:name)

    should validate_presence_of(:slug)
    should validate_length_of(:slug).is_at_most(255)
    should validate_uniqueness_of(:slug)
  end
end

Attempting to run test called "validations" results in the following output:

# Running:

......

Finished in 0.196336s, 30.5599 runs/s, 30.5599 assertions/s.
6 runs, 6 assertions, 0 failures, 0 errors, 0 skips

⏵ Task `test test/models/category_test.rb -n ""validations""` finished successfully
⏵ Command: /opt/homebrew/bin/fish -i -c 'bin/rails'

With this fix:

# Running:

......

Finished in 0.212972s, 28.1727 runs/s, 28.1727 assertions/s.
6 runs, 6 assertions, 0 failures, 0 errors, 0 skips

⏵ Task `test test/models/category_test.rb -n "validations"` finished successfully
⏵ Command: /opt/homebrew/bin/fish -i -c 'bin/rails'

No changes but capturing the test name as a string without quotes gives more control over tests that, for example, use regular expressions in their names.

Closes #222

@cla-bot cla-bot bot added the cla-signed label Jan 9, 2026
@vitallium vitallium added the minor Used to trigger a minor version bump with Zed Zippy label Jan 9, 2026
@vitallium vitallium force-pushed the vs/fix-ruby-test-name branch from 2001876 to d3fc19a Compare January 9, 2026 20:30
@vitallium vitallium merged commit 7ce4e15 into main Jan 9, 2026
8 checks passed
@vitallium vitallium deleted the vs/fix-ruby-test-name branch January 9, 2026 20:37
Hawkbawk added a commit to Hawkbawk/ruby that referenced this pull request Jan 23, 2026
In PR zed-extensions#229, we changed the runnable detection logic for it, describe,
its, etc. to look inside of strings for their content so that we don't
pass along their quotations to the command line. However, in doing so,
tests that use modules, classes, or symbols were no longer being
detected. Add back detection for those, and a catch-all to make sure we
don't miss any other cases (which is what we had before).
@Hawkbawk Hawkbawk mentioned this pull request Jan 23, 2026
vitallium pushed a commit that referenced this pull request Jan 24, 2026
In #229 , we changed the runnable detection logic for it, describe, its,
etc. to look inside of strings for their content so that we don't pass
along their quotations to the command line. However, in doing so, tests
that use modules, classes, or symbols were no longer being detected. Add
back detection for those, and a catch-all to make sure we don't miss any
other cases (which is what we had before).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed minor Used to trigger a minor version bump with Zed Zippy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

$ZED_CUSTOM_RUBY_TEST_NAME includes double quotes for it blocks

2 participants