Sha256: 74f53eec68031233f443761a526519bb74c46d563dde0c8450282550ccb9bb95
Contents?: true
Size: 1.4 KB
Versions: 57
Compression:
Stored size: 1.4 KB
Contents
require 'test_helper' module Workarea module Catalog class ProductImageTest < TestCase def test_delegates_methods_to_its_asset product_image = Workarea::Catalog::ProductImage.new product_image.image = File.new(product_image_file_path) assert_equal(product_image.image.name, product_image.name) end def test_valid? product = create_product product.images.create(image: product_image_file, position: 0) image = product.images.build image.valid? assert_equal(1, image.position) end def test_always_order_by_position product = create_product product.images.create(image: product_image_file, position: 1) product.images.create(image: product_image_file, position: 0) product.reload assert_equal([0, 1], product.images.map(&:position)) end def test_falling_back_to_recently_updated_sorting product = create_product one = product.images.create!(image: product_image_file, position: 0) two = product.images.create!(image: product_image_file, position: 0) assert_equal([two, one], product.reload.images) end def test_populate_fields product = create_product image = product.images.create!(image: product_image_file, position: 0) assert_equal(1.0, image.image_inverse_aspect_ratio) end end end end
Version data entries
57 entries across 57 versions & 1 rubygems