Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix searcher specs to work both for Rails 5 and 6

Damian Legawieca612a69e2a70
diff --git a/core/spec/lib/search/base_spec.rb b/core/spec/lib/search/base_spec.rb
index 81c3f08841..427bb2f2c0 100644
--- a/core/spec/lib/search/base_spec.rb
+++ b/core/spec/lib/search/base_spec.rb
@@ -58,7 +58,7 @@ describe Spree::Core::Search::Base do
params = { per_page: '', search: { 'price_range_any' => ['Under $10.00', '$10.00 - $15.00'] } }
searcher = described_class.new(ActionController::Parameters.new(params))
expect(searcher.send(:extended_base_scope).to_sql).to match(/<= 10/)
- expect(searcher.send(:extended_base_scope).to_sql).to match(/between 10.0 and 15.0/i)
+ expect(searcher.send(:extended_base_scope).to_sql).to match(/between 10.0 and 15.0|BETWEEN 10 AND 15/i)
expect(searcher.retrieve_products.count).to eq(2)
end
@@ -70,7 +70,7 @@ describe Spree::Core::Search::Base do
searcher_pln = described_class.new(ActionController::Parameters.new(params_pln))
searcher_pln.current_currency = 'PLN'
expect(searcher_pln.send(:extended_base_scope).to_sql).to match(/<= 10/)
- expect(searcher_pln.send(:extended_base_scope).to_sql).to match(/between 10.0 and 15.0/i)
+ expect(searcher_pln.send(:extended_base_scope).to_sql).to match(/between 10.0 and 15.0|BETWEEN 10 AND 15/i)
expect(searcher_pln.retrieve_products.count).to eq(1)
end