File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
lib/rspec-api/matchers/filter Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def initialize(options = {})
1313 end
1414
1515 def matches? ( response )
16- super && all_objects_have_field? && has_two_objects ? && is_filtered?
16+ super && all_objects_have_field? && has_one_object ? && is_filtered?
1717 end
1818
1919 def description
@@ -34,8 +34,8 @@ def all_objects_have_field?
3434 end
3535 end
3636
37- def has_two_objects ?
38- if json . length < 2
37+ def has_one_object ?
38+ if json . length < 1
3939 msg = "Cannot test filtering on an array with #{ json . length } items"
4040 raise RSpec ::Core ::Pending ::PendingDeclaredInExample . new msg
4141 else
Original file line number Diff line number Diff line change 5050 end
5151 end
5252
53- it 'is pending given a JSON collection with less than 2 objects ' do
54- response . body = '[{"id": 1} ]'
53+ it 'is pending given a JSON collection with less than 1 object ' do
54+ response . body = '[]'
5555 expect {
5656 expect ( response ) . to be_filtered by : :id
57- } . to be_pending_with %r{Cannot test filtering on an array with 1 item }
57+ } . to be_pending_with %r{Cannot test filtering on an array with 0 items }
5858 end
5959
6060 it 'fails given a collection of objects without the filtering field' do
You can’t perform that action at this time.
0 commit comments