Class: Spree::MailerPreviews::OrderPreview

Inherits:
ActionMailer::Preview
  • Object
show all
Defined in:
lib/spree/mailer_previews/order_preview.rb

Instance Method Summary collapse

Instance Method Details

#cancelObject



12
13
14
15
16
# File 'lib/spree/mailer_previews/order_preview.rb', line 12

def cancel
  order = Order.with_state(:canceled).last
  raise "Your database needs at least one cancelled order to render this preview" unless order
  Spree::Config.order_mailer_class.cancel_email(order)
end

#confirmObject



6
7
8
9
10
# File 'lib/spree/mailer_previews/order_preview.rb', line 6

def confirm
  order = Order.complete.last
  raise "Your database needs at least one completed order to render this preview" unless order
  Spree::Config.order_mailer_class.confirm_email(order)
end

#inventory_cancellationObject



18
19
20
21
22
# File 'lib/spree/mailer_previews/order_preview.rb', line 18

def inventory_cancellation
  order = Spree::Order.joins(:inventory_units).merge(Spree::InventoryUnit.canceled).last
  raise "Your database needs at least one order with a canceled inventory unit to render this preview" unless order
  Spree::Config.order_mailer_class.inventory_cancellation_email(order, [order.inventory_units.first])
end