From 7e2376a0c587a2ced356663ac08572d6775fabdf Mon Sep 17 00:00:00 2001 From: Daniele Palombo Date: Fri, 13 Nov 2020 19:42:43 +0100 Subject: [PATCH] Remove deprecated method Spree::Store.by_url https://github.com/solidusio/solidus/pull/2041 --- core/app/models/spree/store.rb | 6 ------ core/spec/models/spree/store_spec.rb | 22 ---------------------- 2 files changed, 28 deletions(-) diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb index 5c88b595048..22e7ec113c2 100644 --- a/core/app/models/spree/store.rb +++ b/core/app/models/spree/store.rb @@ -25,12 +25,6 @@ class Store < Spree::Base before_save :ensure_default_exists_and_is_unique before_destroy :validate_not_default - scope :by_url, lambda { |url| where("url like ?", "%#{url}%") } - - class << self - deprecate by_url: "Spree::Store.by_url is DEPRECATED", deprecator: Spree::Deprecation - end - def available_locales locales = super() if locales diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb index 4a2b441c2e3..95a6a34d74b 100644 --- a/core/spec/models/spree/store_spec.rb +++ b/core/spec/models/spree/store_spec.rb @@ -3,30 +3,8 @@ require 'rails_helper' RSpec.describe Spree::Store, type: :model do - before do - allow(Spree::Deprecation).to receive(:warn). - with(/^by_url is deprecated and will be removed/, any_args) - end - it { is_expected.to respond_to(:cart_tax_country_iso) } - describe ".by_url (deprecated)" do - let!(:store) { create(:store, url: "website1.com\nwww.subdomain.com") } - let!(:store_2) { create(:store, url: 'freethewhales.com') } - - before do - expect(Spree::Deprecation).to receive(:warn). - with(/^by_url is deprecated and will be removed/, any_args) - end - - it "should find stores by url" do - by_domain = Spree::Store.by_url('www.subdomain.com') - - expect(by_domain).to include(store) - expect(by_domain).not_to include(store_2) - 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)