2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
|
|
|
require_relative 'fixtures/classes'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "Method#name" do
|
|
|
|
it "returns the name of the method" do
|
|
|
|
"abc".method(:upcase).name.should == :upcase
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns the name even when aliased" do
|
|
|
|
obj = MethodSpecs::Methods.new
|
|
|
|
obj.method(:foo).name.should == :foo
|
|
|
|
obj.method(:bar).name.should == :bar
|
|
|
|
obj.method(:bar).unbind.bind(obj).name.should == :bar
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "for a Method generated by respond_to_missing?" do
|
|
|
|
it "returns the name passed to respond_to_missing?" do
|
|
|
|
@m = MethodSpecs::Methods.new
|
|
|
|
@m.method(:handled_via_method_missing).name.should == :handled_via_method_missing
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|