11060 - fix undefined method tax_category_options error in specs

This commit is contained in:
Ahmed Ejaz
2024-04-22 01:35:28 +05:00
committed by Rachel Arnould
parent aad48b4670
commit da34e7b780
2 changed files with 7 additions and 2 deletions

View File

@@ -24,7 +24,8 @@ module Admin
elsif product_set.errors.present?
@error_counts = { saved: product_set.saved_count, invalid: product_set.invalid.count }
render "index", status: :unprocessable_entity, locals: { producers:, categories:, flash: }
render "index", status: :unprocessable_entity,
locals: { producers:, categories:, tax_category_options:, flash: }
end
end

View File

@@ -89,7 +89,7 @@ class ProductsReflex < ApplicationReflex
html: render(partial: "admin/products_v3/content",
locals: { products: @products, pagy: @pagy, search_term: @search_term,
producer_options: producers, producer_id: @producer_id,
category_options: categories, category_id: @category_id,
category_options: categories, tax_category_options:, category_id: @category_id,
flashes: flash })
)
@@ -125,6 +125,10 @@ class ProductsReflex < ApplicationReflex
Spree::Taxon.order(:name).map { |c| [c.name, c.id] }
end
def tax_category_options
Spree::TaxCategory.order(:name).pluck(:name, :id)
end
def fetch_products
product_query = OpenFoodNetwork::Permissions.new(current_user)
.editable_products.merge(product_scope).ransack(ransack_query).result(distinct: true)