Skip to content

Commit 2988ea6

Browse files
committed
Fix zombifier on memoized methods
* When mutant runs zombified (for self tests) the `Zombie::Mutant` namespace tests the `Mutant` namespace. * So when the `Zombie::Mutant` runs it has to be able to reference the "regular" `Adamantium` not the zombified when testing if a memoized method has to be unwound.
1 parent 8bcbafe commit 2988ea6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v0.12.5 unreleased
2+
3+
* [#1458](https://github.com/mbj/mutant/pull/1458)
4+
5+
Fix zombifier on memoized methods (only relevant for mutant developers).
6+
17
# v0.12.4 2024-06-30
28

39
* [#1455](https://github.com/mbj/mutant/pull/1455)

lib/mutant/matcher/method/instance.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ def self.new(scope:, target_method:)
3030
end
3131
# rubocop:enable Metrics/MethodLength
3232

33+
TARGET_MEMOIZER = ::Mutant::Adamantium
34+
35+
private_constant(*constants(false))
36+
3337
def self.memoized_method?(scope, method_name)
34-
scope.raw < Adamantium && scope.raw.memoized?(method_name)
38+
scope.raw < TARGET_MEMOIZER && scope.raw.memoized?(method_name)
3539
end
3640
private_class_method :memoized_method?
3741

0 commit comments

Comments
 (0)