From 931cb89a9dcdfeb33f1611d9d5c0cb8325542479 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Mon, 11 Mar 2019 18:28:25 +0100 Subject: [PATCH] Move new class to services and rename it --- .../order_cycle_distributed_products.rb} | 2 +- lib/open_food_network/products_renderer.rb | 2 +- .../order_cycle_distributed_products_spec.rb} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename app/{models/distributed_valid_products.rb => services/order_cycle_distributed_products.rb} (97%) rename spec/{models/distributed_valid_products_spec.rb => services/order_cycle_distributed_products_spec.rb} (98%) diff --git a/app/models/distributed_valid_products.rb b/app/services/order_cycle_distributed_products.rb similarity index 97% rename from app/models/distributed_valid_products.rb rename to app/services/order_cycle_distributed_products.rb index af411e0748..c07ddd849f 100644 --- a/app/models/distributed_valid_products.rb +++ b/app/services/order_cycle_distributed_products.rb @@ -4,7 +4,7 @@ # variants are added to that product, but not the order cycle, then the master # variant should not available for customers to purchase. This class filters # out such products so that the customer cannot purchase them. -class DistributedValidProducts +class OrderCycleDistributedProducts def initialize(order_cycle, distributor) @order_cycle = order_cycle @distributor = distributor diff --git a/lib/open_food_network/products_renderer.rb b/lib/open_food_network/products_renderer.rb index 9ccee412da..ef9afb3b1e 100644 --- a/lib/open_food_network/products_renderer.rb +++ b/lib/open_food_network/products_renderer.rb @@ -35,7 +35,7 @@ module OpenFoodNetwork return unless @order_cycle scoper = ScopeProductToHub.new(@distributor) - DistributedValidProducts.new(@order_cycle, @distributor). + OrderCycleDistributedProducts.new(@order_cycle, @distributor). relation. order(taxon_order). each { |product| scoper.scope(product) }. diff --git a/spec/models/distributed_valid_products_spec.rb b/spec/services/order_cycle_distributed_products_spec.rb similarity index 98% rename from spec/models/distributed_valid_products_spec.rb rename to spec/services/order_cycle_distributed_products_spec.rb index b5ce260393..9670c179dd 100644 --- a/spec/models/distributed_valid_products_spec.rb +++ b/spec/services/order_cycle_distributed_products_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe DistributedValidProducts do +describe OrderCycleDistributedProducts do let(:order_cycle) { OrderCycle.new } let(:distributor) { instance_double(Enterprise) }