Files
openfoodnetwork/spec/controllers/shops_controller_spec.rb
David Rodríguez 4c6d894bc0 Bump RuboCop to 1.86.6
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`.
2025-10-27 11:30:33 +01:00

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