Skip to content

Commit fc8253a

Browse files
committed
add :scope to has_many rspec_matchers
1 parent 308ef86 commit fc8253a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/liquid-rails/rspec/drop_matchers.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def matches?(actual)
7171

7272
association = associations[name]
7373
result = association.present? && association[:type] == options[:type]
74+
result = result && association[:options][:scope] == options[:scope] if options[:scope]
7475
result = result && association[:options][:with] == options[:with] if options[:with]
7576
result = result && association[:options][:class_name] == options[:class_name] if options[:class_name]
7677

@@ -82,6 +83,11 @@ def with(class_name)
8283
self
8384
end
8485

86+
def scope(scope_name)
87+
@options[:scope] = scope_name
88+
self
89+
end
90+
8591
def class_name(class_name)
8692
@options[:class_name] = class_name
8793
self

0 commit comments

Comments
 (0)