spec/rest/orders_spec.rb in finapps-5.0.23 vs spec/rest/orders_spec.rb in finapps-5.0.24
- old
+ new
@@ -100,10 +100,11 @@
sort: 'status',
requested: 25,
searchTerm: 'term',
status: %w[1 7],
assignment: 'valid_operator',
+ consumer: 'valid_consumer_id',
relation: %w[valid_order_id]
}
end
it { expect { subject }.not_to raise_error }
@@ -119,23 +120,24 @@
end
it 'builds query and sends proper request' do
subject
url =
"#{versioned_api_path}/orders?filter=%7B%22$or%22:%5B%7B%22public_id%22:" \
- '%7B%22$regex%22:%22%5Eterm%22,%22$options%22:%22i%22%7D%7D,%7B%22applicant.last_name%22:%22term%22%7D' \
- ',%7B%22assignment.last_name%22:%22term%22%7D,%7B%22requestor.reference_no%22:%7B%22$regex%22:%22%5E' \
- 'term%22,%22$options%22:%22i%22%7D%7D%5D,%22status%22:%7B%22$in%22:%5B1,7%5D%7D,%22assignment.' \
- 'operator_id%22:%22valid_operator%22%7D&page=2&requested=25&sort=status'
+ '%7B%22$regex%22:%22%5Eterm%22,%22$options%22:%22i%22%7D%7D,%7B%22applicant.last_name%22:%22' \
+ 'term%22%7D,%7B%22assignment.last_name%22:%22term%22%7D,%7B%22requestor.reference_no%22:%7B%22' \
+ '$regex%22:%22%5Eterm%22,%22$options%22:%22i%22%7D%7D%5D,%22status%22:%7B%22$in%22:%5B1,7%5D%7D,' \
+ '%22assignment.operator_id%22:%22valid_operator%22,%22consumer_id%22:%22valid_consumer_id%22%7D' \
+ '&page=2&requested=25&sort=status'
expect(WebMock).to have_requested(:get, url)
end
it 'builds query and sends proper request with searchTerm/relation exclusivity' do
params[:searchTerm] = nil
subject
url =
- "#{versioned_api_path}/orders?filter=%7B%22status%22:%7B%22$in%22:%5B1," \
- '7%5D%7D,%22assignment.operator_id%22:%22valid_operator%22,%22$or%22:%5B%7B%22public_id%22:%7B%22$in' \
- '%22:%5B%22valid_order_id%22%5D%7D%7D,%7B%22original_order_id%22:%7B%22$in%22:%5B%22valid_order_id%22' \
- '%5D%7D%7D%5D%7D&page=2&requested=25&sort=status'
+ "#{versioned_api_path}/orders?filter=%7B%22status%22:%7B%22$in%22:%5B1,7%5D%7D," \
+ '%22assignment.operator_id%22:%22valid_operator%22,%22consumer_id%22:%22valid_consumer_id%22,' \
+ '%22$or%22:%5B%7B%22public_id%22:%7B%22$in%22:%5B%22valid_order_id%22%5D%7D%7D,%7B%22original_order_id%22:' \
+ '%7B%22$in%22:%5B%22valid_order_id%22%5D%7D%7D%5D%7D&page=2&requested=25&sort=status'
expect(WebMock).to have_requested(:get, url)
end
it 'builds null assignment query properly when supplied w/ empty string' do
FinApps::REST::Orders.new(client).list(assignment: '')