Commit 13812b9
committed
Use conditional hooks for money precision
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 #11361 parent 4a4284d commit 13812b9
1 file changed
+7
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
| 65 | + | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
| |||
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | 118 | | |
125 | | - | |
126 | | - | |
| 119 | + | |
127 | 120 | | |
128 | 121 | | |
129 | 122 | | |
130 | | - | |
| 123 | + | |
131 | 124 | | |
132 | 125 | | |
133 | 126 | | |
134 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
135 | 132 | | |
136 | 133 | | |
137 | 134 | | |
| |||
0 commit comments