Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ensure that order confirmation and cancel emails do not include ineli…

…gible adjustments

Fixes #1555
  • Loading branch information...
commit e38893bfafdb4939d3cfc5505509126a11bfe464 1 parent 6941597
@radar radar authored
View
2  core/app/views/spree/order_mailer/cancel_email.text.erb
@@ -10,7 +10,7 @@ Order Summary [CANCELED]
<% end %>
============================================================
Subtotal: <%= number_to_currency @order.item_total %>
-<% @order.adjustments.each do |adjustment| %>
+<% @order.adjustments.eligible.each do |adjustment| %>
<%= "#{adjustment.label}: #{number_to_currency adjustment.amount}"%>
<% end %>
Order Total: <%= number_to_currency @order.total %>
View
2  core/app/views/spree/order_mailer/confirm_email.text.erb
@@ -10,7 +10,7 @@ Order Summary
<% end %>
============================================================
Subtotal: <%= number_to_currency @order.item_total %>
-<% @order.adjustments.each do |adjustment| %>
+<% @order.adjustments.eligible.each do |adjustment| %>
<%= raw(adjustment.label) %> <%= number_to_currency(adjustment.amount) %>
<% end %>
Order Total: <%= number_to_currency(@order.total) %>
View
23 core/spec/mailers/order_mailer_spec.rb
@@ -19,4 +19,27 @@
confirmation_email.body.should_not include("&quot;")
end
+ context "only shows eligible adjustments in emails" do
+ before do
+ order.adjustments.create({:label => "Eligible Adjustment",
+ :amount => 10,
+ :eligible => true}, :without_protection => true)
+
+ order.adjustments.create!({:label => "Ineligible Adjustment",
+ :amount => -10,
+ :eligible => false}, :without_protection => true)
+ end
+
+ let!(:confirmation_email) { Spree::OrderMailer.confirm_email(order) }
+ let!(:cancel_email) { Spree::OrderMailer.confirm_email(order) }
+
+ specify do
+ confirmation_email.body.should_not include("Ineligible Adjustment")
+ end
+
+ specify do
+ cancel_email.body.should_not include("Ineligible Adjustment")
+ end
+ end
+
end

0 comments on commit e38893b

Please sign in to comment.
Something went wrong with that request. Please try again.