Skip to content

Commit

Permalink
Remove calls to deprecated methods (in both code and specs)
Browse files Browse the repository at this point in the history
  • Loading branch information
oldjackson committed Apr 26, 2020
1 parent 2bf6488 commit 91b54fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,8 @@ def ship_address_attributes=(attributes)
# @note This doesn't persist the change bill_address or ship_address
def assign_default_user_addresses
if user
bill_address = (user.bill_address || user.default_address)
ship_address = (user.ship_address || user.default_address)
bill_address = user.bill_address
ship_address = user.ship_address
# this is one of 2 places still using User#bill_address
self.bill_address ||= bill_address if bill_address.try!(:valid?)
# Skip setting ship address if order doesn't have a delivery checkout step
Expand Down
9 changes: 1 addition & 8 deletions core/spec/models/spree/concerns/user_address_book_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ module Spree
user.save_in_address_book(address.attributes, true)
expect(user.addresses.count).to eq 3
expect(user.ship_address.address1).to eq address.address1
expect(user.default_address.address1).to eq address.address1
end
end
end
Expand Down Expand Up @@ -243,7 +242,6 @@ module Spree
it "sets the passed address as default shipping address" do
subject
expect(user.ship_address).to eq address
expect(user.default_address).to eq address
end
end

Expand Down Expand Up @@ -460,11 +458,6 @@ module Spree
it "stores the ship_address" do
expect(subject.ship_address).to eq ship_address
end

it "is also available as default_address" do
expect(subject.ship_address).to eq ship_address
expect(subject.default_address).to eq ship_address
end
end

describe "#ship_address=" do
Expand Down Expand Up @@ -565,7 +558,7 @@ module Spree
allow(Spree::Address).to receive(:immutable_merge).and_return address
end

it do
it "updates ship_address with its present attributes merged with the passed ones" do
expect(Spree::Address).to receive(:immutable_merge).with(user.ship_address, attributes)
expect(user).to receive(:ship_address=).with address

Expand Down
4 changes: 2 additions & 2 deletions core/spec/models/spree/order/checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def assert_state_changed(order, from, to)
let(:address_kind) { :ship }
before do
order.user = FactoryBot.create(:user)
order.user.default_address = default_address
order.user.ship_address = default_address
order.next!
order.reload
end
Expand All @@ -150,7 +150,7 @@ def assert_state_changed(order, from, to)
let(:address_kind) { :bill }
before do
order.user = FactoryBot.create(:user)
order.user.default_address = default_address
order.user.bill_address = default_address
order.next!
order.reload
end
Expand Down

0 comments on commit 91b54fc

Please sign in to comment.