mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Deal with bad SuppliedProduct data
This commit is contained in:
@@ -12,7 +12,10 @@ module DfcProvider
|
||||
end
|
||||
|
||||
def create
|
||||
supplied_product = import.first
|
||||
supplied_product = import&.first
|
||||
|
||||
return head :bad_request unless supplied_product
|
||||
|
||||
product = SuppliedProductBuilder.import(supplied_product)
|
||||
product.supplier = current_enterprise
|
||||
product.save!
|
||||
|
||||
@@ -63,6 +63,11 @@ describe "SuppliedProducts", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml
|
||||
|
||||
run_test!
|
||||
end
|
||||
|
||||
describe "with empty request body" do
|
||||
let(:supplied_product) { nil }
|
||||
run_test!
|
||||
end
|
||||
end
|
||||
|
||||
response "200", "success" do
|
||||
|
||||
Reference in New Issue
Block a user