rspec/rspec-rails — pull request #467 by jkusar (2011-12-01 16:16:24+00:00)
Title: Check to see that the necessary modules are actually loaded before extending

In our setup, there are times when we load pieces of ActiveRecord but not the entire thing. For example, we have a plugin that does all its work over ActiveResource but still pulls in ActiveRecord's DynamicFinderMatch class to avoid having to reimplement the functionality. However, if our app isn't using ActiveRecord, then RSpec fails to load. The attached changes solve the problem by checking for the needed parts of ActiveRecord instead of if the top-level constant exists.