Skip to content

Commit

Permalink
Remove deprecated method Spree::Store.by_url
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielePalombo authored and kennyadsl committed Jan 28, 2021
1 parent bae6572 commit c265482
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
6 changes: 0 additions & 6 deletions core/app/models/spree/store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 0 additions & 22 deletions core/spec/models/spree/store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c265482

Please sign in to comment.