mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix specs
This commit is contained in:
@@ -71,8 +71,8 @@ class EnterpriseFee < ActiveRecord::Base
|
||||
# Remove this association here instead of using dependent: :destroy because
|
||||
# dependent-destroy acts before this around_filter is called, so ProductsCache
|
||||
# has no way of knowing where this fee was used.
|
||||
order_cycles.clear
|
||||
exchange_fees.destroy_all
|
||||
order_cycles(:reload).clear
|
||||
exchange_fees(:reload).destroy_all
|
||||
|
||||
# Destroy the enterprise fee
|
||||
yield
|
||||
|
||||
@@ -100,7 +100,7 @@ Spree::Variant.class_eval do
|
||||
# Remove this association here instead of using dependent: :destroy because
|
||||
# dependent-destroy acts before this around_filter is called, so ProductsCache
|
||||
# has no way of knowing which exchanges the variant was a member of.
|
||||
exchange_variants.destroy_all
|
||||
exchange_variants(:reload).destroy_all
|
||||
|
||||
# Destroy the variant
|
||||
yield
|
||||
|
||||
@@ -6,11 +6,11 @@ describe RefreshProductsCacheJob do
|
||||
let(:order_cycle) { create(:simple_order_cycle) }
|
||||
|
||||
it "renders products and writes them to cache" do
|
||||
OpenFoodNetwork::ProductsRenderer.any_instance.stub(:products_json) { 'products' }
|
||||
RefreshProductsCacheJob.any_instance.stub(:products_json) { 'products' }
|
||||
|
||||
run_job RefreshProductsCacheJob.new distributor.id, order_cycle.id
|
||||
|
||||
expect(Rails.cache.read("products-json-123-456")).to eq 'products'
|
||||
expect(Rails.cache.read("products-json-#{distributor.id}-#{order_cycle.id}")).to eq 'products'
|
||||
end
|
||||
|
||||
describe "fetching products JSON" do
|
||||
|
||||
Reference in New Issue
Block a user