Fix specs

This commit is contained in:
Rohan Mitchell
2016-02-03 12:28:26 +11:00
parent 3bcd3257a1
commit f756749e02
3 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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