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.
Check to see if the module we're actually working with is loaded (in …
…case only pieces of ActiveRecord are loaded).