Sha256: 7a0ba229d87a355b61788fe3714661839617bb14b6747d7d429dce517a10b896
Contents?: true
Size: 1.32 KB
Versions: 5
Compression:
Stored size: 1.32 KB
Contents
require 'test_helper' module Workarea module MailChimp class CartTest < Workarea::TestCase def test_to_h order = create_placed_order hsh = Cart.new(order, send_full_customer: true).to_h assert_equal(order.id, hsh[:id]) assert_equal("USD", hsh[:currency_code]) assert_equal("11.00", hsh[:order_total]) assert_equal("1.00", hsh[:shipping_total]) assert_equal(1, hsh[:lines].size) assert_equal(2, hsh[:lines].first[:quantity]) assert_equal("SKU", hsh[:lines].first[:product_variant_id]) assert_equal(expected_new_customer_hash, hsh[:customer]) assert_equal("http://www.example.com/cart/resume/#{order.token}", hsh[:checkout_url]) hsh = Cart.new(order, send_full_customer: false).to_h assert_equal(expected_existing_customer_hash, hsh[:customer]) end private def expected_new_customer_hash { id: Digest::MD5.hexdigest("bcrouse-new@workarea.com"), email_address: "bcrouse-new@workarea.com", opt_in_status: false, first_name: "Ben", last_name: "Crouse" } end def expected_existing_customer_hash { id: Digest::MD5.hexdigest("bcrouse-new@workarea.com") } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems