From beec910445490949a3f1911f3e3efc65b0a8a325 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 2 Apr 2015 11:23:28 +1100 Subject: [PATCH] Display tax in cart --- app/views/spree/orders/_form.html.haml | 6 ++++ spec/features/consumer/shopping/cart_spec.rb | 32 ++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 spec/features/consumer/shopping/cart_spec.rb diff --git a/app/views/spree/orders/_form.html.haml b/app/views/spree/orders/_form.html.haml index bba45a53c8..fe46e06fd2 100644 --- a/app/views/spree/orders/_form.html.haml +++ b/app/views/spree/orders/_form.html.haml @@ -56,3 +56,9 @@ %td.text-right %h5.order-total.grand-total= @order.display_total %td + + %tr + %td.text-right{colspan:"3"} (includes tax) + %td.text-right + %span.order-total.tax-total= display_checkout_tax_total(@order) + %td diff --git a/spec/features/consumer/shopping/cart_spec.rb b/spec/features/consumer/shopping/cart_spec.rb new file mode 100644 index 0000000000..1420784c52 --- /dev/null +++ b/spec/features/consumer/shopping/cart_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +feature "full-page cart", js: true do + include AuthenticationWorkflow + include WebHelper + include ShopWorkflow + include UIComponentHelper + + describe "viewing the cart" do + describe "tax" do + let!(:zone) { create(:zone_with_member) } + let(:distributor) { create(:distributor_enterprise, with_payment_and_shipping: true) } + let(:supplier) { create(:supplier_enterprise) } + let!(:order_cycle) { create(:simple_order_cycle, suppliers: [supplier], distributors: [distributor], coordinator: create(:distributor_enterprise), variants: [product.master]) } + let(:enterprise_fee) { create(:enterprise_fee, amount: 11.00, tax_category: product.tax_category) } + let(:product) { create(:taxed_product, supplier: supplier, zone: zone, price: 110.00, tax_rate_amount: 0.1) } + let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor) } + + before do + add_enterprise_fee enterprise_fee + set_order order + add_product_to_cart + visit spree.cart_path + end + + it "shows the total tax for the order, including product tax and tax on fees" do + save_screenshot '/home/rohan/ss.png', full: true + page.should have_selector '.tax-total', text: '11.00' # 10 + 1 + end + end + end +end