mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-11 18:26:50 +00:00
There were a few changes needed: * Plugins are now specified through `plugin:` config keyword. * All plugin gems need to be specified explicitly in Gemfile since they are no longer dependencies of plugins already specified explicitly. * All plugin gems need to be updated in other to use the new APIs. * One cop was renamed. * New offenses safe to correct were corrected directly with `bundle exec rubocop -a`. * New offenses unsafe to correct were added to the TODO configuration with `bundle exec rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400 --no-auto-gen-timestamp`.
74 lines
2.0 KiB
Ruby
74 lines
2.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
RSpec.describe ShopsController do
|
|
include WebHelper
|
|
|
|
render_views
|
|
|
|
let!(:distributor) { create(:distributor_enterprise, with_payment_and_shipping: true) }
|
|
|
|
it 'renders distributed product properties' do
|
|
product_property = create(:property, presentation: 'eggs')
|
|
product = create(:product, properties: [product_property])
|
|
producer = create(:supplier_enterprise)
|
|
|
|
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":"eggs","presentation":"eggs"}\]/)
|
|
end
|
|
|
|
it 'renders distributed producer properties' do
|
|
producer_property = create(:property, presentation: 'certified')
|
|
producer = create(:supplier_enterprise, properties: [producer_property])
|
|
product = create(:product, supplier_id: producer.id)
|
|
|
|
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":
|
|
"certified","presentation":"certified"}\]/x)
|
|
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_variants << product.variants.first
|
|
|
|
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
|