spec/models/scimitar/resources/mixin_spec.rb in scimitar-1.0.2 vs spec/models/scimitar/resources/mixin_spec.rb in scimitar-1.0.3

- old
+ new

@@ -520,10 +520,26 @@ fail # Block should never be called! end end.to raise_error(RuntimeError) end + it 'complaints about unsupported multiple operators, handling value spaces' do + expect do + @instance.send(:all_matching_filter, filter: 'type eq "work with spaces" and primary pr', within_array: []) do + fail # Block should never be called! + end + end.to raise_error(RuntimeError) + end + + it 'complaints about unquoted values with spaces' do + expect do + @instance.send(:all_matching_filter, filter: 'type eq work with spaces', within_array: []) do + fail # Block should never be called! + end + end.to raise_error(RuntimeError) + end + it 'calls block with matches' do array = [ { 'type' => 'work', 'value' => 'work_1@test.com' @@ -563,10 +579,14 @@ 'value' => 'boolean@test.com' }, { 'type' => 'work"', 'value' => 'work_trailing_dquote@test.com' + }, + { + 'type' => 'spaced', + 'value' => 'value with spaces' } ] call_count = 0 @@ -583,10 +603,15 @@ @instance.send(:all_matching_filter, filter: 'type eq true', within_array: array) do |matched_hash, index| call_count += 1 expect(matched_hash['value']).to eql('boolean@test.com') end - expect(call_count).to eql(3) + @instance.send(:all_matching_filter, filter: 'value eq "value with spaces"', within_array: array) do |matched_hash, index| + call_count += 1 + expect(matched_hash['type']).to eql('spaced') + end + + expect(call_count).to eql(4) end end # "context '#all_matching_filter' do" # --------------------------------------------------------------------- # Internal: #from_patch_backend