From b850f10d2e028783eb181b1c1ae29bb719c2cc4f Mon Sep 17 00:00:00 2001 From: Arun Kumar Mohan Date: Sat, 26 Sep 2020 16:26:44 -0500 Subject: [PATCH] Improve classification specs' performance --- spec/models/spree/classification_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/models/spree/classification_spec.rb b/spec/models/spree/classification_spec.rb index 4d0f089e56..2eb3fd68e1 100644 --- a/spec/models/spree/classification_spec.rb +++ b/spec/models/spree/classification_spec.rb @@ -2,11 +2,11 @@ require 'spec_helper' module Spree describe Classification do - let!(:product) { create(:simple_product) } - let!(:taxon) { create(:taxon) } - let(:classification) { create(:classification, taxon: taxon, product: product) } + let(:product) { build_stubbed(:simple_product) } + let(:taxon) { build_stubbed(:taxon) } it "won't destroy if classification is the primary taxon" do + classification = Classification.new(taxon: taxon, product: product) product.primary_taxon = taxon expect(classification.destroy).to be false expect(classification.errors.messages[:base]).to eq(["Taxon #{taxon.name} is the primary taxon of #{product.name} and cannot be deleted"])