How to test method alias ruby

前端 未结 4 1833
夕颜
夕颜 2021-01-13 14:50

How to test if if method has an alias?

Let\'s say we have

Class Test
  class << self
    def a;end
    alias :b :a
  end
end

4条回答
  •  囚心锁ツ
    2021-01-13 15:12

    You can set a result to your function to check if result is same.

    def a
      return 'test string'
    end
    

    then it { expect(Test.b).to eq(Test.a) }

    is it ok?

提交回复
热议问题