O'Reilly logo
  • liangliang lin thinks this is interesting:

RSpec hooks run automatically at specific times during testing.

From

Cover of Effective Testing with RSpec 3

Note

每个example例子运行,都会调用hook,但有些例子不需要hook中但实例变量,会比较浪费,如果example组非常大,就会造成大量但浪费(每个例子都有自己都实例变量,是不共享的)