Skip to content
Browse files

Checking for existence of ActiveRecord in proxy.rb before getting con…

…stants from it.
  • Loading branch information...
1 parent fb55955 commit 780c42bc28148a249bd6ca675356ac6e8e92e9dd @jonhyman jonhyman committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/rspec/rails/extensions/active_record/proxy.rb
View
2 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|

0 comments on commit 780c42b

Please sign in to comment.
Something went wrong with that request. Please try again.