Skip to content

chore: infer RSpec metadata about "type" of test from file location #2268

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 4 commits into from
Aug 15, 2025

Conversation

olleolleolle
Copy link
Collaborator

@olleolleolle olleolleolle commented Aug 12, 2025

This quality-of-life PR configures RSpec's inference of types of test by where they are placed in the filesystem. We follow all the regular conventions, so it ought to just work.

How it works:

  • RSpec Rails (the gem) finds files in conventional directories
  • It automatically adds type: :model for example, for files in spec/models
  • That way, all the metadata that we use to add type-specific behavior is kept, but out of the way

@olleolleolle olleolleolle changed the title Use rspec metadata inferred chore: infer RSpec metadata about "type" of test from file location Aug 13, 2025
@@ -1,5 +1,3 @@
require "spec_helper"

RSpec.describe Admin::InvitationsController, type: :controller do
Copy link
Contributor

@matyikriszta matyikriszta Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olleolleolle should we remove the type here as well? Or do we have to keep it since it's in the admin folder within the controllers folder? Not sure how the metadata inference works exactly.

Copy link
Collaborator Author

@olleolleolle olleolleolle Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, too. Every file under spec/controllers and below. Another PR does that removing.

@matyikriszta matyikriszta merged commit 03b0800 into codebar:master Aug 15, 2025
2 checks passed
@olleolleolle olleolleolle deleted the use-rspec-metadata-inferred branch August 16, 2025 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants