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.

Added missing `Store#integrations` association

Damian Legawiec33ba7812816b
diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb
index 8f4c8609ab..bb493761eb 100644
--- a/core/app/models/spree/store.rb
+++ b/core/app/models/spree/store.rb
@@ -101,8 +101,10 @@ module Spree
has_many :custom_domains, class_name: 'Spree::CustomDomain', dependent: :destroy
has_one :default_custom_domain, -> { where(default: true) }, class_name: 'Spree::CustomDomain'
- has_many :posts
- has_many :post_categories
+ has_many :posts, class_name: 'Spree::Post'
+ has_many :post_categories, class_name: 'Spree::PostCategory'
+
+ has_many :integrations, class_name: 'Spree::Integration'
#
# Page Builder associations
@@ -341,7 +343,7 @@ module Spree
def default_stock_location
@default_stock_location ||= begin
- stock_location_scope = Spree::StockLocation.order_default
+ stock_location_scope = Spree::StockLocation.where(default: true)
stock_location_scope.first || ActiveRecord::Base.connected_to(role: :writing) do
stock_location_scope.create(default: true, name: Spree.t(:default_stock_location_name), country: default_country)
end
diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb
index d4550b7cb4..1ec7578a82 100644
--- a/core/spec/models/spree/store_spec.rb
+++ b/core/spec/models/spree/store_spec.rb
@@ -205,6 +205,15 @@ describe Spree::Store, type: :model, without_global_store: true do
end
end
+ describe '#create_default_theme' do
+ let(:store) { build(:store) }
+
+ it 'creates a default theme' do
+ expect(store).to receive(:create_default_theme)
+ store.save!
+ end
+ end
+
describe '#import_products_from_store' do
let(:store) { build(:store, import_products_from_store_id: other_store.id) }
let(:other_store) { create(:store) }