From 780c42bc28148a249bd6ca675356ac6e8e92e9dd Mon Sep 17 00:00:00 2001 From: Jonathan Hyman Date: Sat, 18 Aug 2012 09:59:06 -0400 Subject: [PATCH] Checking for existence of ActiveRecord in proxy.rb before getting constants from it. --- lib/rspec/rails/extensions/active_record/proxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec/rails/extensions/active_record/proxy.rb b/lib/rspec/rails/extensions/active_record/proxy.rb index c6b277ed1f..402375eaef 100644 --- a/lib/rspec/rails/extensions/active_record/proxy.rb +++ b/lib/rspec/rails/extensions/active_record/proxy.rb @@ -1,7 +1,7 @@ RSpec.configure do |rspec| # Delay this in order to give users a chance to configure `expect_with`... rspec.before(:suite) do - if defined?(RSpec::Matchers) && RSpec::Matchers.configuration.syntax.include?(:should) + if defined?(RSpec::Matchers) && RSpec::Matchers.configuration.syntax.include?(:should) && defined?(ActiveRecord) # In Rails 3.0, it was AssociationProxy. # In 3.1+, it's CollectionProxy. const_name = [:CollectionProxy, :AssociationProxy].find do |const|