diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb index bb0d4e70d52..5c88b595048 100644 --- a/core/app/models/spree/store.rb +++ b/core/app/models/spree/store.rb @@ -49,12 +49,6 @@ def available_locales=(locales) end end - def self.current(store_key) - Spree::Deprecation.warn "Spree::Store.current is DEPRECATED" - current_store = Store.find_by(code: store_key) || Store.by_url(store_key).first if store_key - current_store || Store.default - end - def self.default where(default: true).first || new end diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb index 272594a3ea4..4a2b441c2e3 100644 --- a/core/spec/models/spree/store_spec.rb +++ b/core/spec/models/spree/store_spec.rb @@ -27,38 +27,6 @@ end end - describe '.current (deprecated)' do - let!(:store_1) { create(:store) } - let!(:store_default) { create(:store, name: 'default', default: true) } - let!(:store_2) { create(:store, default: false, url: 'www.subdomain.com') } - let!(:store_3) { create(:store, default: false, url: 'www.another.com', code: 'CODE') } - - before do - expect(Spree::Deprecation).to receive(:warn). - with(/^Spree::Store.current is DEPRECATED/, any_args) - end - - delegate :current, to: :described_class - - context "with no match" do - it 'should return the default domain' do - expect(current('foobar.com')).to eql(store_default) - end - end - - context "with matching url" do - it 'should return matching store' do - expect(current('www.subdomain.com')).to eql(store_2) - end - end - - context "with matching code" do - it 'should return matching store' do - expect(current('CODE')).to eql(store_3) - end - end - end - describe ".default" do it "should ensure saved store becomes default if one doesn't exist yet" do expect(Spree::Store.where(default: true).count).to eq(0)