mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-01 06:41:41 +00:00
Update specs
This commit is contained in:
@@ -102,8 +102,7 @@ describe Api::V0::ProductsController, type: :controller do
|
||||
expect(response.status).to eq(422)
|
||||
expect(json_response["error"]).to eq("Invalid resource. Please fix errors and try again.")
|
||||
errors = json_response["errors"]
|
||||
expect(errors.keys).to match_array(["name", "primary_taxon", "shipping_category",
|
||||
"supplier", "variant_unit"])
|
||||
expect(errors.keys).to match_array(["name", "primary_taxon", "supplier", "variant_unit"])
|
||||
end
|
||||
|
||||
it "can update a product" do
|
||||
|
||||
@@ -71,7 +71,7 @@ describe Api::V0::ReportsController, type: :controller do
|
||||
"variant" => line_item.full_name,
|
||||
"quantity" => line_item.quantity,
|
||||
"price" => (line_item.quantity * line_item.price).to_s,
|
||||
"temp_controlled" => line_item.product.shipping_category&.temperature_controlled
|
||||
"temp_controlled" => line_item.variant.shipping_category&.temperature_controlled
|
||||
}.
|
||||
merge(dimensions(line_item)).
|
||||
merge(contacts(line_item.order.bill_address))
|
||||
@@ -89,7 +89,7 @@ describe Api::V0::ReportsController, type: :controller do
|
||||
"variant" => line_item.full_name,
|
||||
"quantity" => line_item.quantity,
|
||||
"price" => (line_item.quantity * line_item.price).to_s,
|
||||
"temp_controlled" => line_item.product.shipping_category&.temperature_controlled
|
||||
"temp_controlled" => line_item.variant.shipping_category&.temperature_controlled
|
||||
}.merge(dimensions(line_item))
|
||||
end
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ FactoryBot.define do
|
||||
variant_unit_scale { 1 }
|
||||
variant_unit_name { '' }
|
||||
|
||||
shipping_category { DefaultShippingCategory.find_or_create }
|
||||
|
||||
# ensure stock item will be created for this products master
|
||||
before(:create) { create(:stock_location) if Spree::StockLocation.count.zero? }
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ describe ProductImport::ProductImporter do
|
||||
expect(carrots.on_hand).to eq 5
|
||||
expect(carrots.variants.first.price).to eq 3.20
|
||||
expect(carrots.primary_taxon.name).to eq "Vegetables"
|
||||
expect(carrots.shipping_category).to eq shipping_category
|
||||
expect(carrots.variants.first.shipping_category).to eq shipping_category
|
||||
expect(carrots.supplier).to eq enterprise
|
||||
expect(carrots.variants.first.unit_presentation).to eq "500g"
|
||||
end
|
||||
|
||||
@@ -123,8 +123,7 @@ describe Spree::Order::Checkout do
|
||||
let(:order) { create(:order_with_totals_and_distribution, ship_address: create(:address) ) }
|
||||
let(:shipping_method) { create(:shipping_method, distributors: [order.distributor]) }
|
||||
let(:other_shipping_category) { create(:shipping_category) }
|
||||
let(:other_product) { create(:product, shipping_category: other_shipping_category ) }
|
||||
let(:other_variant) { other_product.variants.first }
|
||||
let(:other_variant) { create(:variant, shipping_category: other_shipping_category) }
|
||||
|
||||
before do
|
||||
order.order_cycle = create(:simple_order_cycle,
|
||||
|
||||
@@ -182,7 +182,7 @@ describe "Product Import" do
|
||||
|
||||
carrots = Spree::Product.find_by(name: 'Carrots')
|
||||
expect(carrots.variants.first.tax_category).to eq tax_category
|
||||
expect(carrots.shipping_category).to eq shipping_category
|
||||
expect(carrots.variants.first.shipping_category).to eq shipping_category
|
||||
end
|
||||
|
||||
it "records a timestamp on import that can be viewed and filtered under Bulk Edit Products" do
|
||||
|
||||
@@ -110,7 +110,7 @@ describe '
|
||||
expect(product.variants.first.price.to_s).to eq('19.99')
|
||||
expect(product.on_hand).to eq(5)
|
||||
expect(product.variants.first.tax_category_id).to eq(tax_category.id)
|
||||
expect(product.shipping_category).to eq(shipping_category)
|
||||
expect(product.variants.first.shipping_category).to eq(shipping_category)
|
||||
expect(product.description).to eq("<p>A description...</p>")
|
||||
expect(product.group_buy).to be_falsey
|
||||
expect(product.variants.first.unit_presentation).to eq("5kg")
|
||||
|
||||
Reference in New Issue
Block a user