From 3e7e24d700ca2c1d860c9392d84f9834f17e2076 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Fri, 5 Apr 2019 15:38:10 +0200 Subject: [PATCH] Make VariantController specs aware of destroy call In v2 we no longer rely on `Variant#delete` but `Variant#destroy` so stubbed calls needed fixing. --- .../spree/admin/variants_controller_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/controllers/spree/admin/variants_controller_spec.rb b/spec/controllers/spree/admin/variants_controller_spec.rb index 65293b53ab..0e290014dc 100644 --- a/spec/controllers/spree/admin/variants_controller_spec.rb +++ b/spec/controllers/spree/admin/variants_controller_spec.rb @@ -42,17 +42,17 @@ module Spree context 'when requesting with js' do before do allow(Spree::Variant).to receive(:find).with(variant.id.to_s) { variant } - allow(variant).to receive(:delete) + allow(variant).to receive(:destroy).and_call_original end - it 'deletes the variant' do + it 'destroys the variant' do spree_delete :destroy, id: variant.id, product_id: variant.product.permalink, format: 'js' - expect(variant).to have_received(:delete) + expect(variant).to have_received(:destroy) end it 'shows a success flash message' do spree_delete :destroy, id: variant.id, product_id: variant.product.permalink, format: 'js' - expect(flash[:success]).to eq(I18n.t('notice_messages.variant_deleted')) + expect(flash[:success]).to be end it 'renders spree/admin/shared/destroy' do @@ -77,17 +77,17 @@ module Spree context 'when requesting with html' do before do allow(Spree::Variant).to receive(:find).with(variant.id.to_s) { variant } - allow(variant).to receive(:delete) + allow(variant).to receive(:destroy).and_call_original end it 'deletes the variant' do spree_delete :destroy, id: variant.id, product_id: variant.product.permalink, format: 'html' - expect(variant).to have_received(:delete) + expect(variant).to have_received(:destroy) end it 'shows a success flash message' do spree_delete :destroy, id: variant.id, product_id: variant.product.permalink, format: 'html' - expect(flash[:success]).to eq(I18n.t('notice_messages.variant_deleted')) + expect(flash[:success]).to be end it 'redirects to admin_product_variants_url' do