spec/mongo/collection/view/readable_spec.rb in mongo-2.2.1 vs spec/mongo/collection/view/readable_spec.rb in mongo-2.2.2

- old
+ new

@@ -375,10 +375,21 @@ it 'returns an empty array' do expect(distinct).to be_empty end end + + context 'when the field does not exist' do + + let(:distinct) do + view.distinct(:doesnotexist) + end + + it 'returns an empty array' do + expect(distinct).to be_empty + end + end end context 'when no selector is provided' do let(:documents) do @@ -458,9 +469,16 @@ }.to raise_error(Mongo::Error::OperationFailure) end it 'sets the max_time_ms option on the command' do expect(view.distinct(:field, max_time_ms: 100)).to eq([ 'test' ]) + end + end + + context 'when the field does not exist' do + + it 'returns an empty array' do + expect(view.distinct(:nofieldexists)).to be_empty end end end describe '#hint' do