mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-31 21:37:16 +00:00
Improve filter shipping methods tag rule specs' performance
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) { "" } }
|
||||
|
||||
Reference in New Issue
Block a user