-
Notifications
You must be signed in to change notification settings - Fork 634
RSpec: Use conditional hooks for money precision #1138
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
Open
tagliala
wants to merge
2
commits into
RubyMoney:main
Choose a base branch
from
tagliala:chore/1136-prepare-for-rspec-4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4e32ce0
to
58b85a1
Compare
58b85a1
to
e5dd1b1
Compare
🤔 This looks to be a random failure. I can't replicate this locally
|
76d2ac2
to
dc065ef
Compare
9685ee5
to
5b448a0
Compare
sunny
approved these changes
Jul 15, 2025
Workflows run with extended set of permissions by default. By specifying any permission explicitly, all others are set to none. Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions JRuby 10.0 Requires Java 21 but Java 17 was used. This eliminates the following error: ``` Error: LinkageError occurred while loading main class org.jruby.Main java.lang.UnsupportedClassVersionError: org/jruby/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0 JRuby failed to start, try Java 21 envs ```
Move the `Money.default_infinite_precision` test setup from a shared context into global, conditional RSpec hooks. The previous `shared_context` approach, which relied on implicit metadata inclusion, is deprecated and was failing with the modern `shared_context_metadata_behavior = :apply_to_host_groups` setting. An explicit `include_context` is unsuitable because this behavior is sometimes required for individual examples (`it` blocks), where contexts cannot be included. This commit defines global `before` and `after` hooks in the RSpec configuration that are filtered by the `:default_infinite_precision_true` metadata tag. This provides a declarative and efficient way to apply the necessary setup and teardown to any example group or individual example without repetitive code, while aligning with modern RSpec practices. Close RubyMoney#1136
5b448a0
to
83d2622
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Move the
Money.default_infinite_precision
test setup from a shared context into global, conditional RSpec hooks.The previous
shared_context
approach, which relied on implicit metadata inclusion, is deprecated and was failing with the modernshared_context_metadata_behavior = :apply_to_host_groups
setting.An explicit
include_context
is unsuitable because this behavior is sometimes required for individual examples (it
blocks), where contexts cannot be included.This commit defines global
before
andafter
hooks in the RSpec configuration that are filtered by the:default_infinite_precision_true
metadata tag. This provides a declarative and efficient way to apply the necessary setup and teardown to any example group or individual example without repetitive code, while aligning with modern RSpec practices.Close #1136