spec/rest/documents_orders_spec.rb in finapps-5.0.30 vs spec/rest/documents_orders_spec.rb in finapps-5.0.31
- old
+ new
@@ -58,9 +58,24 @@
'%22term%22%7D,%7B%22reference_no%22:%7B%22$regex%22:%22%5Eterm%22,%22$options%22:%22i%22%7D%7D%5D,'\
'%22consumer_id%22:%22valid_consumer_id%22%7D&page=2&requested=25&sort=tag '
expect(WebMock).to have_requested(:get, url)
end
+
+ context 'with search term containing spaces' do
+ let(:params) { { "searchTerm": 'Blue Jay', "page": 2 } }
+ it 'builds query and sends proper request' do
+ list
+ url =
+ "#{versioned_api_path}/documents/orders?filter=%7B%22$or%22:%5B%7B%22applicant.email%22:"\
+ '%22Blue%20Jay%22%7D,%7B%22applicant.first_name%22:%22Blue%20Jay%22%7D,%7B%22applicant.last_name%22:'\
+ '%22Blue%20Jay%22%7D,%7B%22reference_no%22:%7B%22$regex%22:%22%5EBlue%20Jay%22,%22$options%22:'\
+ '%22i%22%7D%7D,%7B%22applicant.first_name%22:%22Blue%22%7D,%7B%22applicant.last_name%22:%22Blue%22%7D,'\
+ '%7B%22applicant.first_name%22:%22Jay%22%7D,%7B%22applicant.last_name%22:%22Jay%22%7D%5D%7D&page=2'
+
+ expect(WebMock).to have_requested(:get, url)
+ end
+ end
end
end
context 'with invalid params' do
let(:params) { ['invalid array'] }