Sha256: e5770461062b8b3639a9bf95f8fa6d44d89e13380ec885ad3f94e4a43289d627

Contents?: true

Size: 754 Bytes

Versions: 4

Compression:

Stored size: 754 Bytes

Contents

require 'test_helper'

class LocalImagePresetsTest < ActiveSupport::TestCase

  setup do
    @record = ImageAttached.create(image: fixture_file_upload('/image.jpg', 'image/jpeg'))
  end

  test "should save/destory main image and thumbs" do
    original = Rails.root.join('tmp', 'uploads', 'images', 'original', @record.image.filename)
    big = Rails.root.join('tmp', 'uploads', 'images', 'big', @record.image.filename)
    small = Rails.root.join('tmp', 'uploads', 'images', 'small', @record.image.filename)

    assert ::File.exists?(original)
    assert ::File.exists?(big)
    assert ::File.exists?(small)
    
    @record.destroy
   
    assert !::File.exists?(original)
    assert !::File.exists?(big)
    assert !::File.exists?(small)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
attachs-0.3.5 test/local_image_record_test.rb
attachs-0.3.2 test/local_image_record_test.rb
attachs-0.3.1 test/local_image_record_test.rb
attachs-0.3.0 test/local_image_record_test.rb