Sha256: 957f800b04f259510de0c6b8c620df323fc9f11178bc42342cf14a157e3a42b6

Contents?: true

Size: 913 Bytes

Versions: 5

Compression:

Stored size: 913 Bytes

Contents

require 'test_helper'

class UploadTest < ActiveSupport::TestCase
  include StorageHelper

  test 'upload' do
    upload = Upload.create(file: image, record_type: 'Shop', record_attribute: 'logo')
    upload.run_callbacks :commit

    shop = Shop.create(logo: upload)
    shop.run_callbacks :commit
    assert_equal 5, shop.logo.paths.size
    upload.file.styles.each do |style, geometry|
      assert_url upload.file.url(style)
    end
    shop.logo.styles.each do |style, geometry|
      assert_url shop.logo.url(style)
    end
    shop.logo.destroy

    shop = Shop.create(logo: upload.id)
    shop.run_callbacks :commit
    assert_equal 5, shop.logo.paths.size
    upload.file.styles.each do |style, geometry|
      assert_url upload.file.url(style)
    end
    shop.logo.styles.each do |style, geometry|
      assert_url shop.logo.url(style)
    end
    shop.logo.destroy

    upload.file.destroy
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
attachs-4.0.0.5 test/upload_test.rb
attachs-4.0.0.4 test/upload_test.rb
attachs-4.0.0.3 test/upload_test.rb
attachs-4.0.0.2 test/upload_test.rb
attachs-4.0.0.1 test/upload_test.rb