Skip to content

Commit

Permalink
Merge pull request #3407 from rubinius/method-equality-3118
Browse files Browse the repository at this point in the history
Fix Method equalitiy
  • Loading branch information
jemc committed May 24, 2015
2 parents 621953b + cadc8ad commit 73e862e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions kernel/common/block_environment.rb
Expand Up @@ -105,6 +105,7 @@ def ==(other)
# when given a Proc.
#
# The methods are equal if the BEs are equal.
return false unless other.kind_of? AsMethod

@block_env == other.block_env
end
Expand Down
8 changes: 8 additions & 0 deletions spec/ruby/core/method/shared/eql.rb
Expand Up @@ -54,6 +54,14 @@
@m_foo.send(@method, m2).should be_true
end

it "returns false if comparing a method defined via define_method and def" do
defn = @m.method(:zero)
defined = @m.method(:zero_defined_method)

defn.send(@method, defined).should be_false
defined.send(@method, defn).should be_false
end

describe 'missing methods' do
it "returns true for the same method missing" do
miss1 = @m.method(:handled_via_method_missing)
Expand Down

0 comments on commit 73e862e

Please sign in to comment.