Fix admin api exchange products controller

This commit is contained in:
Gaetan Craig-Riou
2024-03-05 20:33:36 +11:00
parent a873fa692b
commit 53e7b02471
2 changed files with 3 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ module Api
attributes :name, :supplier_name, :image_url, :variants
def supplier_name
object.supplier&.name
object.variants.first.supplier&.name
end
def image_url

View File

@@ -39,7 +39,7 @@ module Api
api_get :index, exchange_id: exchange.id, order_cycle_id: 666, enterprise_id: 666,
incoming: false
expect(json_response["products"].first["supplier_name"])
.to eq exchange.variants.first.product.supplier.name
.to eq exchange.variants.first.supplier.name
end
end
@@ -48,7 +48,7 @@ module Api
api_get :index, order_cycle_id: order_cycle.id, enterprise_id: exchange.sender_id,
incoming: true
expect(json_response["products"].first["supplier_name"])
.to eq exchange.variants.first.product.supplier.name
.to eq exchange.variants.first.supplier.name
end
end
end