File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,26 @@ def foo
75
75
foo . call . should == 'm'
76
76
end
77
77
78
+ it "updates the optimized method when a prepended module is updated" do
79
+ out = ruby_exe ( <<~RUBY )
80
+ module M; end
81
+ class Integer
82
+ prepend M
83
+ end
84
+ l = -> { 1 + 2 }
85
+ p l.call
86
+ M.module_eval do
87
+ def +(o)
88
+ $called = true
89
+ super(o)
90
+ end
91
+ end
92
+ p l.call
93
+ p $called
94
+ RUBY
95
+ out . should == "3\n 3\n true\n "
96
+ end
97
+
78
98
it "updates the method when there is a base included method and the prepended module overrides it" do
79
99
base_module = Module . new do
80
100
def foo
Original file line number Diff line number Diff line change 1
1
fails:Module#prepend uses only new module when dupping the module
2
2
fails:Module#prepend prepends a module if it is included in a super class
3
3
fails:Module#prepend when module already exists in ancestor chain modifies the ancestor chain
4
+ slow:Module#prepend updates the optimized method when a prepended module is updated
You can’t perform that action at this time.
0 commit comments