Sha256: c645a9593e154a2dc1444503af7eaa87ec7e68b0174c7a2d12ca77949841ccf5
Contents?: true
Size: 1.12 KB
Versions: 28
Compression:
Stored size: 1.12 KB
Contents
require 'test_helper' module Workarea class Fulfillment module Policies class DownloadTest < TestCase def test_process order = Order.new(user_id: '1234') item = order.items.build(sku: 'SKU1') fulfillment = Fulfillment.new( id: order.id, items: [{ order_item_id: item.id.to_s, quantity: 1 }] ) sku = create_fulfillment_sku( id: 'SKU1', policy: 'download', file: product_image_file ) policy = Policies::Download.new(sku) policy.process(order_item: item, fulfillment: fulfillment) assert_equal(1, Fulfillment::Token.count) token = Fulfillment::Token.first assert_equal(order.id.to_s, token.order_id) assert_equal(item.id.to_s, token.order_item_id) assert_equal(sku.id, token.sku) assert_equal(1, fulfillment.items.first.events.size) assert_equal('shipped', fulfillment.items.first.events.first.status) assert_equal(1, fulfillment.items.first.events.first.quantity) end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems