Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Voucher:' before voucher code on edit cart page #13061

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/views/spree/orders/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
- checkout_adjustments_for(@order, exclude: [:line_item]).reverse_each do |adjustment|
%tr.order-adjustment
%td.text-right{:colspan => "3"}
= adjustment.label
- if adjustment.originator_type == "Voucher"
= "#{t(:voucher)}:"
= adjustment.label
- else
= adjustment.label
%td.text-right.total
%span= adjustment.display_amount.to_html
%td
Expand Down
26 changes: 26 additions & 0 deletions spec/views/spree/orders/edit.html.haml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,30 @@
expect(rendered).to have_selector(".unit-price")
end
end

describe "display adjustments" do
let(:voucher) { create(:voucher, enterprise: order.distributor) }

before do
voucher.create_adjustment(voucher.code, order)
OrderManagement::Order::Updater.new(order).update_voucher
render
end

it "includes Voucher text with label" do
expect(rendered).to have_content("Voucher:\n#{voucher.code}")
end

# Shipping fee is derived from 'completed_order_with_fees' factory.
# It applies when using shipping method such as Home Delivery.
it "includes Shipping label" do
expect(rendered).to have_content("Shipping")
end

# Transaction fee is derived from 'completed_order_with_fees' factory.
# It applies when using payment methods such as Check & Stripe.
it "includes Transaction fee label" do
expect(rendered).to have_content("Transaction fee")
end
end
end
Loading