mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
Cover #distributed_properties \w a controller spec
This exercises the controller and the serializer ensuring the integration works allowing to confidently refactor things further.
This commit is contained in:
@@ -15,4 +15,25 @@ describe ShopsController, type: :controller do
|
||||
get :index
|
||||
expect(response.body).to have_content(invisible_distributor.name)
|
||||
end
|
||||
|
||||
it 'renders distributed properties' do
|
||||
duplicate_property = create(:property, presentation: 'dairy')
|
||||
producer = create(:supplier_enterprise, properties: [duplicate_property])
|
||||
property = create(:property, presentation: 'dairy')
|
||||
product = create(:product, properties: [property])
|
||||
producer.supplied_products << product
|
||||
|
||||
create(
|
||||
:simple_order_cycle,
|
||||
coordinator: distributor,
|
||||
suppliers: [producer],
|
||||
distributors: [distributor],
|
||||
variants: [product.variants]
|
||||
)
|
||||
|
||||
get :index
|
||||
|
||||
expect(response.body)
|
||||
.to match(/"distributed_properties":\[{"id":\d+,"name":"dairy","presentation":"dairy"}\]/)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user