From 0abb4d043408e31aa0da8dc4e514016ae7c190c6 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Tue, 20 Dec 2016 15:45:56 -0800 Subject: [PATCH] Require the store_key arg of Store.current The previous behaviour was deprecated --- core/app/models/spree/store.rb | 3 +-- core/spec/models/spree/store_spec.rb | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb index 2f48da61ef6..ed985837717 100644 --- a/core/app/models/spree/store.rb +++ b/core/app/models/spree/store.rb @@ -21,8 +21,7 @@ class Store < Spree::Base scope :by_url, lambda { |url| where("url like ?", "%#{url}%") } - def self.current(store_key = nil) - Spree::Deprecation.warn "Spree::Store.current needs a code or URL as an argument. If you want the default store use Spree::Store.default", caller if !store_key + def self.current(store_key) current_store = Store.find_by(code: store_key) || Store.by_url(store_key).first if store_key current_store || Store.default end diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb index 2155a880e7b..a82c7bb0ff9 100644 --- a/core/spec/models/spree/store_spec.rb +++ b/core/spec/models/spree/store_spec.rb @@ -23,14 +23,6 @@ delegate :current, to: :described_class - context "with no argument" do - it 'should return default' do - Spree::Deprecation.silence do - expect(current).to eql(store_default) - end - end - end - context "with no match" do it 'should return the default domain' do expect(current('foobar.com')).to eql(store_default)