Skip to content

Commit

Permalink
Fixup linter errors in InMemoryOrderUpdater
Browse files Browse the repository at this point in the history
Co-Authored-By: Jared Norman <[email protected]>
Co-Authored-By: benjamin wil <[email protected]>
Co-Authored-By: Kendra Riga <[email protected]>
Co-Authored-By: Sofia Besenski <[email protected]>
  • Loading branch information
5 people committed Dec 20, 2024
1 parent 7e76070 commit 27e4988
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions core/app/models/spree/in_memory_order_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module Spree
class InMemoryOrderUpdater
attr_reader :order

delegate :payments, :line_items, :adjustments, :all_adjustments, :shipments, :quantity, to: :order

def initialize(order)
Expand All @@ -26,7 +27,8 @@ def recalculate(persist: true)
update_shipments
recalculate_shipment_state
end
Spree::Bus.publish :order_recalculated, order: order

Spree::Bus.publish(:order_recalculated, order:)

persist_totals if persist
end
Expand Down Expand Up @@ -238,8 +240,8 @@ def log_state_change(name)
order.state_changes.new(
previous_state: old_state,
next_state: new_state,
name: name,
user_id: order.user_id
user_id: order.user_id,
name:
)
end
end
Expand Down
2 changes: 2 additions & 0 deletions core/app/models/spree/item_total_updater.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Spree::ItemTotalUpdater
class << self
def recalculate(item)
Expand Down
2 changes: 1 addition & 1 deletion core/spec/models/spree/in_memory_order_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ module Spree
allow(order_adjuster).to receive(:call) { raise NotImplementedError }
allow(Spree::InMemoryOrderUpdater::InMemoryOrderAdjuster).to receive(:new).and_return(order_adjuster)

expect{described_class.new(order).recalculate(persist: false)}
expect{ described_class.new(order).recalculate(persist: false) }
.to raise_error(NotImplementedError)
end
end
Expand Down
2 changes: 1 addition & 1 deletion core/spec/models/spree/item_total_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
subject { described_class.recalculate(item) }

let(:item) { create :line_item, adjustments: [adjustment] }
let(:adjustment) { create :adjustment, amount: 1}
let(:adjustment) { create :adjustment, amount: 1 }

it "sets the adjustment total on the item" do
expect { subject }
Expand Down

0 comments on commit 27e4988

Please sign in to comment.