Sha256: ead96aa47b243b923355278637f44266d7f6a43c5dbb46de37ea2c7f9668e1e5
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
require 'test_helper' module Workarea module MailChimp class OrderTest < Workarea::TestCase def test_to_h order = create_placed_order hsh = Order.new(order).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_address_hash, hsh[:shipping_address]) assert_equal(expected_address_hash, hsh[:billing_address]) assert_equal(expected_customer_hash, hsh[:customer]) end private def expected_address_hash { name:"Ben Crouse", address1:"22 S. 3rd St.", address2:"Second Floor", city:"Philadelphia", province:"PA", postal_code:"19106", country:"US", phone:"", company:"" } end def expected_customer_hash { id: Digest::MD5.hexdigest("bcrouse-new@workarea.com"), email_address: "bcrouse-new@workarea.com", opt_in_status: false, orders_count: 1, total_spent: "11.00", first_name: "Ben", last_name: "Crouse" } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-mail_chimp-3.0.3 | test/services/workarea/mail_chimp/order_test.rb |
workarea-mail_chimp-3.0.2 | test/services/workarea/mail_chimp/order_test.rb |