Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/method/fixtures/classes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def foo

alias bar foo
alias baz bar
alias qux baz

def same_as_foo
true
Expand Down
6 changes: 6 additions & 0 deletions core/method/original_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
obj.method(:baz).unbind.bind(obj).original_name.should == :foo
end

it "returns the original name even when aliased thrice" do
obj = MethodSpecs::Methods.new
obj.method(:qux).original_name.should == :foo
obj.method(:qux).unbind.bind(obj).original_name.should == :foo
end

it "returns the source UnboundMethod's name (not the name given to define_method)" do
klass = Class.new { define_method(:my_inspect, ::Kernel.instance_method(:inspect)) }
klass.new.method(:my_inspect).original_name.should == :inspect
Expand Down
1 change: 1 addition & 0 deletions core/unboundmethod/fixtures/classes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def with_block(&block); end

alias bar foo
alias baz bar
alias qux baz
alias alias_1 foo
alias alias_2 foo

Expand Down
6 changes: 6 additions & 0 deletions core/unboundmethod/original_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
UnboundMethodSpecs::Methods.instance_method(:baz).original_name.should == :foo
end

it "returns the original name even when aliased thrice" do
obj = UnboundMethodSpecs::Methods.new
obj.method(:qux).unbind.original_name.should == :foo
UnboundMethodSpecs::Methods.instance_method(:qux).original_name.should == :foo
end

it "returns the source UnboundMethod's name (not the name given to define_method)" do
klass = Class.new { define_method(:my_inspect, ::Kernel.instance_method(:inspect)) }
klass.instance_method(:my_inspect).original_name.should == :inspect
Expand Down