Sha256: 7574eba0e8d473c8f77970c62ec5352a2d0e8ee7f37cb451abd18943f52af066
Contents?: true
Size: 1.11 KB
Versions: 62
Compression:
Stored size: 1.11 KB
Contents
require 'test_helper' module Workarea module Storefront class InventoryStatusViewModelTest < TestCase def test_message inventory = create_inventory( id: 'SKU', policy: 'standard', available: 10, backordered: 10 ) view_model = InventoryStatusViewModel.new(inventory) assert_equal('In Stock', view_model.message) inventory.available = 2 assert_equal('Only 2 Left', view_model.message) inventory.policy = 'allow_backorder' inventory.available = 0 inventory.backordered_until = Date.new(2014, 12, 10) assert_equal('Ships on 10 Dec', view_model.message) inventory.backordered_until = nil assert_equal('Backordered', view_model.message) inventory.policy = 'standard' assert_equal('Out of Stock', view_model.message) inventory.policy = 'allow_backorder' inventory.available = 0 inventory.backordered = 0 inventory.backordered_until = Date.new(2017, 12, 10) assert_equal('Out of Stock', view_model.message) end end end end
Version data entries
62 entries across 62 versions & 1 rubygems