Sha256: 68c22539a7150e252a810f08ec4b0384e0af1b6f240e4791ff951c08acfb902e
Contents?: true
Size: 1.02 KB
Versions: 62
Compression:
Stored size: 1.02 KB
Contents
require 'test_helper' module Workarea class DiscountIdsTest < TestCase class DiscountIdsModel include Mongoid::Document include DiscountIds embeds_many :price_adjustments, class_name: 'Workarea::PriceAdjustment', extend: PriceAdjustmentExtension end def discount_price_adjustments @discount_price_adjustments ||= [ PriceAdjustment.new(data: { 'discount_id' => 1 }), PriceAdjustment.new(data: { 'discount_id' => 2 }), PriceAdjustment.new(data: { 'discount_id' => 3 }) ] end def test_save discount_ids_model = DiscountIdsModel.new discount_ids_model.price_adjustments = discount_price_adjustments discount_ids_model.save! assert_equal([1, 2, 3], discount_ids_model.as_document['discount_ids']) end def test_discount_ids discount_ids_model = DiscountIdsModel.new discount_ids_model.price_adjustments = discount_price_adjustments assert_equal([1, 2, 3], discount_ids_model.discount_ids) end end end
Version data entries
62 entries across 62 versions & 1 rubygems