Skip to content
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

Tag the examples generated by run_test! for easier filtering #516

Merged
merged 2 commits into from
Aug 27, 2022

Conversation

asavageiv
Copy link
Contributor

Problem

rswag rspec examples aren't tagged, so in applications where there are a lot of request specs that aren't rswag specs a lot of time is wasted running those irrelevant specs.

Solution

Tagging rspec examples allows for easy filtering in a custom rake task

This concerns this parts of the Open API Specification:

N/A

The changes I made are compatible with:

  • OAS2
  • OAS3
  • OAS3.1

Related Issues

N/A

Checklist

  • [NA] Added tests
  • Changelog updated
  • Added documentation to README.md

Steps to Test or Reproduce

cd test_app
rspec --tag rswag

README.md Outdated Show resolved Hide resolved
Copy link

@lafferty151 lafferty151 left a comment

Choose a reason for hiding this comment

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

Why not just wrap your rswag specs in their own describe or context example group and add your rswag tag there?

Or put them into their own file(s) w/ a naming convention that allows you to filter them by PATTERN= or a custom .rspec or options file?

Do we really need this built into the gem itself?

@asavageiv
Copy link
Contributor Author

The short answer is simplicity and scalability.

Wrapping the specs means requiring a developer to remember to do so. It's possible, but a slight burden. Renaming the files means breaking the existing file naming conventions.

The other route I considered was adding support to rswag for passing tags to run_test!.

@jtannas
Copy link
Collaborator

jtannas commented May 18, 2022

Wrapping the specs means requiring a developer to remember to do so.

Agreed. I'm not a fan of solutions that depend on people consistently remembering to do something. Inevitably someone starts coding before having their morning coffee and things go sideways 🙃

Copy link
Collaborator

@jtannas jtannas left a comment

Choose a reason for hiding this comment

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

lgtm 👍
it's a minor code change that's very useful to those who want it
@BookOfGreg

@asavageiv
Copy link
Contributor Author

Thanks jtannas. Just need approval from a maintainer now

@jtannas jtannas merged commit 01867da into rswag:master Aug 27, 2022
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.

None yet

3 participants