Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Admin: Ability to set property position
Damian Legawiecb5669a1970c2
diff --git a/admin/spec/controllers/spree/admin/properties_controller_spec.rb b/admin/spec/controllers/spree/admin/properties_controller_spec.rbindex f70c873ec1..b70b053633 100644--- a/admin/spec/controllers/spree/admin/properties_controller_spec.rb+++ b/admin/spec/controllers/spree/admin/properties_controller_spec.rb@@ -16,4 +16,26 @@ describe Spree::Admin::PropertiesController, type: :controller doexpect(assigns(:collection).to_a).to eq([property])endend++ describe '#create ' do+ it 'creates a property' do+ expect { post :create, params: {property: {name: 'New Property', presentation: 'New Presentation'}} }.to change(Spree::Property, :count).by(1)+ end+ end++ describe '#update' do+ let(:property) { create(:property) }++ it 'updates the property' do+ put :update, params: {id: property.id, property: { name: 'New Name'}}++ expect(property.reload.name).to eq('new-name')+ end++ it 'can set property position' do+ put :update, params: {id: property.id, property: { position: 2 }}++ expect(property.reload.position).to eq(2)+ end+ endenddiff --git a/core/lib/spree/permitted_attributes.rb b/core/lib/spree/permitted_attributes.rbindex f7560cad2c..08c4f7ea69 100644--- a/core/lib/spree/permitted_attributes.rb+++ b/core/lib/spree/permitted_attributes.rb@@ -101,7 +101,7 @@ module Spree}]- @@property_attributes = [:name, :presentation]+ @@property_attributes = [:name, :presentation, :position]@@return_authorization_attributes = [:amount, :memo, :stock_location_id, :inventory_units_attributes,:return_authorization_reason_id]