Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例子:
def setup end def teardown end
如何在设置方法中获取当前案例名称?
在 Ruby 1.9.3 中,您可以执行以下操作:
def setup puts self.__name__ end
在 ruby 2.1.5 附带的单元测试中,它似乎是:
def setup p method_name end