Skip to content

Apply correct hierarchy and IDs to Minitest spec items #3501

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

Merged
merged 2 commits into from
May 20, 2025

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented May 16, 2025

Motivation

We were incorrectly creating the test hierarchy for Minitest specs. First, we weren't handling the nesting correctly for classes.

Second, we were not properly matching what Minitest does if you decide to create a test group using a class inside a describe. In this scenario, Minitest does not use the describe's description as part of the resulting group ID. For example:

class MySpec < Minitest::Spec
  describe "something" do
    class InnerSpec < Minitest::Spec
      it "works" do
      end
    end
  end
end

The correct ID for the inner spec group is MySpec::InnerSpec and not MySpec::something::InnerSpec.

Implementation

I started using a flat stack of group IDs that differentiate between a class group or a describe group, so that we can do the right thing depending on what we find.

Automated Tests

Added tests.

Copy link
Member Author

vinistock commented May 16, 2025


How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels May 16, 2025 — with Graphite App
@vinistock vinistock self-assigned this May 16, 2025
@vinistock vinistock marked this pull request as ready for review May 16, 2025 19:24
@vinistock vinistock requested a review from a team as a code owner May 16, 2025 19:24
@vinistock vinistock force-pushed the 05-15-fix_spec_example_hierarchy branch from f005ec3 to f9a12bb Compare May 16, 2025 19:57
@vinistock vinistock force-pushed the 05-15-fix_spec_example_hierarchy branch from f9a12bb to a1ac859 Compare May 16, 2025 20:30
Base automatically changed from 05-15-add_spec_to_load_path_when_running_minitest_specs to main May 20, 2025 13:04
@vinistock vinistock merged commit 15c335a into main May 20, 2025
44 checks passed
@vinistock vinistock deleted the 05-15-fix_spec_example_hierarchy branch May 20, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants