Following the advice here I wrote some specs that use Object#method
to test that a method was properly aliased. In some cases the class is aliasing a method the comes from an included module. This works for me in 2.2 but not in 2.3 and 2.4
I did some experimentation and the difference can be boiled down to this:
module Foo
def foo
end
alias_method :foo_foo, :foo
end
class Bar
include Foo
alias_method :bar, :foo
end
bar = Bar.new
bar.method(:foo) == bar.method(:bar)
# true in Ruby 2.2
# false in Ruby 2.3+
bar.method(:foo) == bar.method(:foo_foo)
# true in Ruby 2.2+
Does anyone know if this was an intentional change in Ruby 2.3? If so, what's going on here?
I specifically tested 2.2.3, 2.2.7, 2.3.0, 2.3.3, 2.3.4, and 2.4.1.