summaryrefslogtreecommitdiff
path: root/spec/ruby/core/method/to_proc_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/method/to_proc_spec.rb')
-rw-r--r--spec/ruby/core/method/to_proc_spec.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/ruby/core/method/to_proc_spec.rb b/spec/ruby/core/method/to_proc_spec.rb
index 92bd64aaf1..4993cce239 100644
--- a/spec/ruby/core/method/to_proc_spec.rb
+++ b/spec/ruby/core/method/to_proc_spec.rb
@@ -35,7 +35,7 @@ describe "Method#to_proc" do
end
it "returns a proc that can be used by define_method" do
- x = 'test'
+ x = +'test'
to_s = class << x
define_method :foo, method(:to_s).to_proc
to_s
@@ -90,4 +90,15 @@ describe "Method#to_proc" do
array.each(&obj)
ScratchPad.recorded.should == [[1, 2]]
end
+
+ it "returns a proc that properly invokes module methods with super" do
+ m1 = Module.new { def foo(ary); ary << :m1; end; }
+ m2 = Module.new { def foo(ary = []); super(ary); ary << :m2; end; }
+ c2 = Class.new do
+ include m1
+ include m2
+ end
+
+ c2.new.method(:foo).to_proc.call.should == %i[m1 m2]
+ end
end