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.
我有一个 ruby 应用程序,除其他外,它需要在退出时关闭一些数据库。为此,我使用该 at_exit方法。代码看起来像这样:
at_exit
at_exit do close_databases #more code say_goodbye end require "gems" #...code
我有所有使用的方法调用的规范,但我希望能够测试at_exit方法内的代码。可能吗?如果是这样,我该如何为此编写规范?