I have a class as follows:
class User
alias_method :nickname, :username
def username
self.name.split(' ').first.downcase
end
end
I would like to test that the method :nickname
is an alias for :username
.
Both the following don't work:
user = User.new
User.instance_method(:nick_name) == User.instance_method(:username)
user.method(:nick_name) == user.method(:username)
A similar discussion happened at How to test method alias ruby , but the answers stated there don't work.