Files
openfoodnetwork/spec/models/spree/option_value_spec.rb
2016-02-25 11:08:53 +11:00

27 lines
735 B
Ruby

require 'spec_helper'
module Spree
describe OptionValue do
describe "products cache" do
let(:variant) { create(:variant) }
let(:option_value) { create(:option_value) }
before do
variant.option_values << option_value
option_value.reload
end
it "refreshes the products cache on change, via variant" do
expect(OpenFoodNetwork::ProductsCache).to receive(:variant_changed).with(variant)
option_value.name = 'foo'
option_value.save!
end
it "refreshes the products cache on destruction, via variant" do
expect(OpenFoodNetwork::ProductsCache).to receive(:variant_changed).with(variant)
option_value.destroy
end
end
end
end