mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Update admin views, tests pass
This commit is contained in:
@@ -23,7 +23,7 @@ Spree::Product.class_eval do
|
||||
|
||||
# Build a product distribution for each distributor
|
||||
def build_product_distributions
|
||||
Distributor.all.each do |distributor|
|
||||
Enterprise.is_distributor.each do |distributor|
|
||||
unless self.product_distributions.find_by_distributor_id distributor.id
|
||||
self.product_distributions.build(:distributor => distributor)
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
= f.field_container :supplier do
|
||||
= f.label :supplier
|
||||
%br
|
||||
= f.collection_select(:supplier_id, Supplier.all, :id, :name, :include_blank => true)
|
||||
= f.collection_select(:supplier_id, Enterprise.is_supplier, :id, :name, :include_blank => true)
|
||||
= f.error_message_on :supplier
|
||||
|
||||
@@ -8,8 +8,8 @@ feature %q{
|
||||
include WebHelper
|
||||
|
||||
background do
|
||||
@supplier = create(:supplier, :name => 'New supplier')
|
||||
@distributors = (1..3).map { create(:distributor) }
|
||||
@supplier = create(:supplier_enterprise, :name => 'New supplier')
|
||||
@distributors = (1..3).map { create(:distributor_enterprise) }
|
||||
@shipping_method = create(:shipping_method, :name => 'My shipping method')
|
||||
end
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ feature 'shipping methods' do
|
||||
|
||||
scenario "deleting a shipping method referenced by a product distribution" do
|
||||
p = create(:product)
|
||||
d = create(:distributor)
|
||||
d = create(:distributor_enterprise)
|
||||
create(:product_distribution, product: p, distributor: d, shipping_method: @sm)
|
||||
|
||||
visit_delete spree.admin_shipping_method_path(@sm)
|
||||
@@ -38,7 +38,7 @@ feature 'shipping methods' do
|
||||
|
||||
scenario "deleting a shipping method referenced by a line item" do
|
||||
sm2 = create(:shipping_method)
|
||||
d = create(:distributor)
|
||||
d = create(:distributor_enterprise)
|
||||
|
||||
p = create(:product)
|
||||
create(:product_distribution, product: p, distributor: d, shipping_method: sm2)
|
||||
|
||||
Reference in New Issue
Block a user