Skip to content

Commit

Permalink
Rename send_shipment_emails
Browse files Browse the repository at this point in the history
  • Loading branch information
jhawthorn committed Sep 25, 2015
1 parent 706f451 commit 4bba0c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core/app/models/spree/order_shipping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def ship(inventory_units:, stock_location:, address:, shipping_method:,
end
end

send_shipment_email(carton) if stock_location.fulfillable? && !suppress_mailer # e.g. digital gift cards that aren't actually shipped
send_shipment_emails(carton) if stock_location.fulfillable? && !suppress_mailer # e.g. digital gift cards that aren't actually shipped
fulfill_order_stock_locations(stock_location)
@order.update!

Expand All @@ -85,7 +85,7 @@ def fulfill_order_stock_locations(stock_location)
Spree::OrderStockLocation.fulfill_for_order_with_stock_location(@order, stock_location)
end

def send_shipment_email(carton)
def send_shipment_emails(carton)
carton.orders.each do |order|
Spree::CartonMailer.shipped_email(order, carton).deliver_later
end
Expand Down
11 changes: 6 additions & 5 deletions core/spec/models/spree/shipment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -670,11 +670,12 @@
end

it 'does not send a confirmation email' do
expect(unshippable_shipment).to_not receive(:send_shipment_email)
unshippable_shipment.ready!
unshippable_shipment.inventory_units(true).each do |unit|
expect(unit.state).to eq('shipped')
end
expect {
unshippable_shipment.ready!
unshippable_shipment.inventory_units(true).each do |unit|
expect(unit.state).to eq('shipped')
end
}.not_to change{ ActionMailer::Base.deliveries.count }
end
end

Expand Down

0 comments on commit 4bba0c6

Please sign in to comment.