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

Use RSpec annotations instead of included class to trigger RSpec hooks #881

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mvz
Copy link
Contributor

@mvz mvz commented Dec 25, 2022

Summary

Use type: :aruba to trigger all RSpec hooks in the default integration, replacing the check for inclusion of Aruba::Api.

Details

When using the default aruba/rspec integration, the initial inclusion of Aruba::Api was triggered by a type: :aruba annotation to the spec, but the other hooks were filtered by a check for inclusion of Aruba::Api.

Since we already use :type to trigger inclusion of Aruba::Api, we can safely use it to activate the around hooks as well, thus simplifying the code

This also increases safety for custom integrations, since having those work correctly depended on "aruba/rspec" never being loaded.

Motivation and Context

This improves simplicity of the code by relying on existing mechanisms instead of introducing our own.

How Has This Been Tested?

CI will check this

Types of changes

  • (Maybe) bug fix (non-breaking change which fixes an issue)
  • Internal change (refactoring, test improvements, developer experience or update of dependencies)

@mvz
Copy link
Contributor Author

mvz commented Dec 25, 2022

Needs work since the specs secretly relied on the hooks in aruba/rspec 😢

mvz added 4 commits March 17, 2024 15:26
Since we already use :type to trigger inclusion of Aruba::Api, we can
safely use it to activate the around hooks as well.

This also increases safety for custom integrations, since having those
work correctly depended on "aruba/rspec" never being loaded.
Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

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

🚀 Looks super!

(Well, the idea is super. Some order-of-operations may still be in our way.)

@mvz mvz marked this pull request as draft April 1, 2024 14:57
mvz added 2 commits April 1, 2024 17:28
In particular, if we use the shared context 'uses aruba API', we have an
object @aruba that includes Aruba::Api, and all the methods available on
that are also available on each spec example. The results can be
different however, since each has its own config instance.
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