Improve filter shipping methods tag rule specs' performance

This commit is contained in:
Arun Kumar Mohan
2020-09-22 01:24:42 -05:00
parent bb38523767
commit 6c27ac5f99
2 changed files with 3 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ FactoryBot.define do
end
factory :filter_shipping_methods_tag_rule, class: TagRule::FilterShippingMethods do
enterprise { FactoryBot.create :distributor_enterprise }
enterprise factory: :distributor_enterprise
end
factory :filter_products_tag_rule, class: TagRule::FilterProducts do

View File

@@ -1,7 +1,7 @@
require 'spec_helper'
describe TagRule::FilterShippingMethods, type: :model do
let!(:tag_rule) { create(:filter_shipping_methods_tag_rule) }
let!(:tag_rule) { build_stubbed(:filter_shipping_methods_tag_rule) }
describe "determining whether tags match for a given shipping method" do
context "when the shipping method is nil" do
@@ -11,7 +11,7 @@ describe TagRule::FilterShippingMethods, type: :model do
end
context "when the shipping method is not nil" do
let(:shipping_method) { create(:shipping_method, tag_list: ["member", "local", "volunteer"]) }
let(:shipping_method) { build_stubbed(:shipping_method, tag_list: ["member", "local", "volunteer"]) }
context "when the rule has no preferred shipping method tags specified" do
before { allow(tag_rule).to receive(:preferred_shipping_method_tags) { "" } }