Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Unify OptionType#filter_param with Property#filter_param format

Damian Legawiec109c0bf278b0
diff --git a/core/app/models/spree/option_type.rb b/core/app/models/spree/option_type.rb
index bd4abab517..978364a081 100644
--- a/core/app/models/spree/option_type.rb
+++ b/core/app/models/spree/option_type.rb
@@ -26,7 +26,7 @@ module Spree
after_touch :touch_all_products
def filter_param
- name.titleize.delete(' ').downcase
+ name.parameterize
end
def self.color
diff --git a/core/spec/models/spree/option_type_spec.rb b/core/spec/models/spree/option_type_spec.rb
index 0758edd5fa..cff2a25ef5 100644
--- a/core/spec/models/spree/option_type_spec.rb
+++ b/core/spec/models/spree/option_type_spec.rb
@@ -12,19 +12,19 @@ describe Spree::OptionType, type: :model do
end
end
- context '#filter_param' do
+ describe '#filter_param' do
let!(:option_type) { create(:option_type, name: 'color', presentation: 'Color') }
let!(:other_option_type) { create(:option_type, name: 'secondary color', presentation: 'Secondary Color') }
let!(:some_option_type) { create(:option_type, name: 'option type', presentation: 'Some Option Type') }
it 'returns filtered name param' do
expect(option_type.filter_param).to eq('color')
- expect(other_option_type.filter_param).to eq('secondarycolor')
- expect(some_option_type.filter_param).to eq('optiontype')
+ expect(other_option_type.filter_param).to eq('secondary-color')
+ expect(some_option_type.filter_param).to eq('option-type')
end
end
- context '#self.color' do
+ describe '#self.color' do
let!(:option_type) { create(:option_type, name: 'color', presentation: 'Color') }
it 'finds color option type' do