Rspec 3.5についての記載となります。 documentにallow-any-instance-of/expect-any-instance-ofは使わない方がよいと書かれています。 This feature is sometimes useful when working with legacy code, though in general we discourage its use for a number of reasons: The rspec-mocks API is designed for individual object instances, but this feature operates on entire classes of objects. As a result there are some semantically confusing edge