Sha256: a75b3f3fd207153c691f6a5c6cc39b6d49b897c7a8b75417287abaae3b8331ff

Contents?: true

Size: 797 Bytes

Versions: 10

Compression:

Stored size: 797 Bytes

Contents

require 'test_helper'

class S3FileUploadTest < ActiveSupport::TestCase

  setup do
    load_s3 
    @file = RailsUploads::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_url = @file.url
    assert_object_s3 uploads_url

    base_url = 'http://cdn.example.com'
    Rails.application.config.uploads.base_url = base_url
    assert_equal ::File.join(base_url, @file.path), @file.url
    Rails.application.config.uploads.base_url = ''

    @file.delete
    assert_not_object_s3 uploads_url
    assert !@file.exists?
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rails_uploads-0.2.9 test/unit/s3_file_upload_tes.rb
rails_uploads-0.2.8 test/unit/s3_file_upload_tes.rb
rails_uploads-0.2.7 test/unit/s3_file_upload_tes.rb
rails_uploads-0.2.6 test/unit/s3_file_upload_tes.rb
rails_uploads-0.2.5 test/unit/s3_file_upload_tes.rb
rails_uploads-0.2.4 test/unit/s3_file_upload_tes.rb
rails_uploads-0.2.3 test/unit/s3_file_upload_tes.rb
rails_uploads-0.2.2 test/unit/s3_file_upload_tes.rb
rails_uploads-0.2.1 test/unit/s3_file_upload_tes.rb
rails_uploads-0.2.0 test/unit/s3_file_upload_tes.rb