Skip to content

Commit 088bd0a

Browse files
committed
Prevent an attempt of adding should for RSpec 4
1 parent 6e6a597 commit 088bd0a

File tree

1 file changed

+4
-1
lines changed
  • lib/rspec/rails/extensions/active_record

1 file changed

+4
-1
lines changed

lib/rspec/rails/extensions/active_record/proxy.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
RSpec.configure do |rspec|
22
# Delay this in order to give users a chance to configure `expect_with`...
33
rspec.before(:suite) do
4-
if defined?(RSpec::Matchers) && RSpec::Matchers.configuration.syntax.include?(:should) && defined?(ActiveRecord::Associations)
4+
if defined?(RSpec::Matchers) &&
5+
RSpec::Matchers.configuration.respond_to?(:syntax) && # RSpec 4 dropped support for monkey-patching `should` syntax
6+
RSpec::Matchers.configuration.syntax.include?(:should) &&
7+
defined?(ActiveRecord::Associations)
58
RSpec::Matchers.configuration.add_should_and_should_not_to ActiveRecord::Associations::CollectionProxy
69
end
710
end

0 commit comments

Comments
 (0)