1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2018-03-26 20:48:21 +00:00
parent 6c2b589865
commit 9245e097ec
7 changed files with 108 additions and 64 deletions

View file

@ -104,6 +104,20 @@ describe "Module#prepend" do
c.new.alias.should == :m
end
it "reports the class for the owner of an aliased method on the class" do
m = Module.new
c = Class.new { prepend(m); def meth; :c end; alias_method :alias, :meth }
c.instance_method(:alias).owner.should == c
end
ruby_version_is "2.3" do
it "reports the class for the owner of a method aliased from the prepended module" do
m = Module.new { def meth; :m end }
c = Class.new { prepend(m); alias_method :alias, :meth }
c.instance_method(:alias).owner.should == c
end
end
it "sees an instance of a prepended class as kind of the prepended module" do
m = Module.new
c = Class.new { prepend(m) }