Sha256: a42a25f110b77ecb261c5afc840f09b3f80a01ec054a0757349ee9cc92dab7a2
Contents?: true
Size: 843 Bytes
Versions: 4
Compression:
Stored size: 843 Bytes
Contents
require 'test_helper' class LocalFileUploadTest < ActiveSupport::TestCase setup do @file = Attachs::Types::File.new(fixture_file_upload('/image.jpg', 'image/jpeg')) end test "file should exists and mantain properties" do assert @file.exists? assert_equal 58841, @file.size assert_equal '.jpg', @file.extname end test "should store/delete file correctly and accept cdn" do @file.store uploads_path = Rails.root.join('tmp', 'uploads', 'files', @file.filename) assert ::File.exists?(uploads_path) base_url = 'http://cdn.example.com' Rails.application.config.attachs.base_url = base_url assert_equal ::File.join(base_url, @file.path), @file.url Rails.application.config.attachs.base_url = '' @file.delete assert !::File.exists?(uploads_path) assert !@file.exists? end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
attachs-0.3.5 | test/local_file_upload_test.rb |
attachs-0.3.2 | test/local_file_upload_test.rb |
attachs-0.3.1 | test/local_file_upload_test.rb |
attachs-0.3.0 | test/local_file_upload_test.rb |