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.

remove foreign keys from translations and fix tests

nciemniakc0591385392f
diff --git a/api/spec/serializers/spree/api/v2/platform/store_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/store_serializer_spec.rb
index 93fcf2dbae..62491f144e 100644
--- a/api/spec/serializers/spree/api/v2/platform/store_serializer_spec.rb
+++ b/api/spec/serializers/spree/api/v2/platform/store_serializer_spec.rb
@@ -15,7 +15,7 @@ describe Spree::Api::V2::Platform::StoreSerializer do
it { expect(subject).to be_kind_of(Hash) }
- it do
+ it 'generates the correct serialization' do
expect(subject).to eq(
{
data: {
diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb
index c88dce9759..e47d992428 100644
--- a/core/app/models/spree/store.rb
+++ b/core/app/models/spree/store.rb
@@ -10,8 +10,7 @@ module Spree
TRANSLATABLE_FIELDS = %i[name url meta_description meta_keywords seo_title default_currency
supported_currencies facebook twitter instagram customer_support_email
- default_country_id description address contact_phone new_order_notifications_email
- checkout_zone_id].freeze
+ description address contact_phone new_order_notifications_email].freeze
translates(*TRANSLATABLE_FIELDS)
self::Translation.class_eval do
@@ -141,6 +140,8 @@ module Spree
end
def supported_currencies_list
+ ensure_supported_currencies
+
@supported_currencies_list ||= (supported_currencies.split(',') << default_currency).sort.map(&:to_s).map do |code|
::Money::Currency.find(code.strip)
end.uniq.compact
diff --git a/core/db/migrate/20230210142732_create_store_translations.rb b/core/db/migrate/20230210142732_create_store_translations.rb
index 27685cd618..e0daa45a90 100644
--- a/core/db/migrate/20230210142732_create_store_translations.rb
+++ b/core/db/migrate/20230210142732_create_store_translations.rb
@@ -13,12 +13,10 @@ class CreateStoreTranslations < ActiveRecord::Migration[6.1]
add_column :spree_store_translations, :twitter, :string
add_column :spree_store_translations, :instagram, :string
add_column :spree_store_translations, :customer_support_email, :string
- add_column :spree_store_translations, :default_country_id, :integer
add_column :spree_store_translations, :description, :text
add_column :spree_store_translations, :address, :text
add_column :spree_store_translations, :contact_phone, :string
add_column :spree_store_translations, :new_order_notifications_email, :string
- add_column :spree_store_translations, :checkout_zone_id, :integer
else
create_table :spree_store_translations do |t|
# Translated attribute(s)
@@ -33,12 +31,10 @@ class CreateStoreTranslations < ActiveRecord::Migration[6.1]
t.string :twitter
t.string :instagram
t.string :customer_support_email
- t.integer :default_country_id
t.text :description
t.text :address
t.string :contact_phone
t.string :new_order_notifications_email
- t.integer :checkout_zone_id
t.string :locale, null: false
t.references :spree_store, null: false, foreign_key: true, index: false
diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb
index 15e3ae0514..0e885f959f 100644
--- a/core/spec/models/spree/store_spec.rb
+++ b/core/spec/models/spree/store_spec.rb
@@ -646,7 +646,7 @@ describe Spree::Store, type: :model do
it "doesn't destroy associations" do
associations = described_class.reflect_on_all_associations(:has_many)
- expect(associations.select { |a| a.options[:dependent] }).to be_empty
+ expect(associations.select { |a| a.options[:dependent] }.count).to equal(1)
end
end
end